/* R.D.M Portal - brand system
   Forest #2D5520 | Sage #72BD74 (logo mark only) | Pale #EAF2E7 / #D7E5D4
   Status: red #CC0000 | orange #B85C00 | green #3C7A33
   Font: Assistant (self-hosted woff2, added via GitHub web UI) */

@font-face {
    font-family: 'Assistant';
    src: url('/assets/fonts/assistant-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Assistant';
    src: url('/assets/fonts/assistant-600.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Assistant';
    src: url('/assets/fonts/assistant-700.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

:root {
    --forest: #2D5520;
    --forest-dark: #214017;
    --sage: #72BD74;
    --pale: #EAF2E7;
    --pale-2: #D7E5D4;
    --ink: #1E2A1B;
    --muted: #5C6B58;
    --line: #C3D4BF;
    --white: #FFFFFF;
    --st-red: #CC0000;
    --st-orange: #B85C00;
    --st-green: #3C7A33;
    --radius: 10px;
    --shadow: 0 2px 14px rgba(45, 85, 32, 0.10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Assistant', -apple-system, 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--pale);
    direction: rtl;
}

a { color: var(--forest); }

:focus-visible {
    outline: 3px solid var(--forest);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- Top bar ---- */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.wordmark {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--forest);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.wordmark span { font-weight: 400; color: var(--muted); }
.wordmark-large {
    font-weight: 700;
    font-size: 1.7rem;
    color: var(--forest);
    letter-spacing: 0.04em;
}
.topnav { display: flex; gap: 18px; flex: 1; }
.topnav a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}
.topnav a:hover { border-bottom-color: var(--sage); }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-name { color: var(--muted); font-size: 0.95rem; text-decoration: none; }
.user-name:hover { color: var(--forest); }

/* ---- Layout ---- */
.app-main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.auth-main {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.page-head h1 { font-size: 1.5rem; margin: 0 0 10px; color: var(--forest-dark); }
.page-head { margin-bottom: 18px; }

/* ---- Auth card ---- */
.auth-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    padding: 34px 30px 28px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-sub { color: var(--muted); margin-top: 2px; }
.auth-links { text-align: center; margin: 18px 0 0; font-size: 0.95rem; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; margin: 14px 0 5px; }
input[type="email"], input[type="password"], input[type="text"],
input[type="number"], input[type="date"], input[type="file"],
select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    font: inherit;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--forest);
    box-shadow: 0 0 0 3px rgba(45, 85, 32, 0.15);
}
.check {
    display: flex; align-items: center; gap: 8px;
    font-weight: 400; margin: 8px 0 4px; cursor: pointer;
}
.check input { width: auto; }
.checks { margin: 10px 0; }
.radios { display: flex; gap: 22px; flex-wrap: wrap; margin: 8px 0; }
.code-input {
    text-align: center;
    letter-spacing: 0.5em;
    font-size: 1.3rem;
    direction: ltr;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--forest); color: var(--white); }
.btn-primary:hover { background: var(--forest-dark); }
.btn-ghost {
    background: transparent;
    color: var(--forest);
    border: 1px solid var(--line);
    padding: 7px 14px;
}
.btn-ghost:hover { background: var(--pale); }
.btn-block { width: 100%; margin-top: 18px; }

/* ---- Notices ---- */
.notice {
    border-radius: 8px;
    padding: 11px 14px;
    margin: 0 0 14px;
    font-size: 0.95rem;
    border: 1px solid;
}
.notice-error   { background: #FBEFEF; border-color: #E4B8B8; color: var(--st-red); }
.notice-success { background: var(--pale);  border-color: var(--line); color: var(--st-green); }
.notice-info    { background: #F3F1E7; border-color: #DDD6B8; color: var(--st-orange); }

/* ---- Empty states ---- */
.empty-state {
    background: var(--white);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 42px 24px;
    text-align: center;
    color: var(--muted);
}

/* ---- Panels & grids ---- */
.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.panel-title { font-size: 1.05rem; margin: 0 0 12px; color: var(--forest-dark); }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.panel-row .panel-title { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.newform > summary { cursor: pointer; font-weight: 600; color: var(--forest); }
.mt { margin-top: 12px; }
.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; margin: 0; }

/* ---- Kanban board ---- */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.col {
    background: var(--pale-2);
    border-radius: var(--radius);
    padding: 10px;
    min-height: 120px;
}
.col h2 { font-size: 1rem; margin: 4px 4px 10px; color: var(--forest-dark); }
.col.drag-over { outline: 2px dashed var(--forest); outline-offset: -2px; }
.count { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.tcard {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.tcard h3 { font-size: 0.98rem; margin: 0 0 6px; }
.tcard h3 a { text-decoration: none; color: var(--ink); }
.tcard h3 a:hover { color: var(--forest); }
.tmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.88rem; margin-bottom: 4px; }
.board-hint { font-size: 0.88rem; margin-top: 10px; }
.overdue { color: var(--st-red); font-weight: 600; }

/* ---- Chips ---- */
.chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--pale);
    color: var(--forest-dark);
    text-decoration: none;
}
.chip-bug            { background: #FBEFEF; color: var(--st-red); }
.chip-question       { background: var(--pale); color: var(--st-green); }
.chip-change_request { background: #F3F1E7; color: var(--st-orange); }
.chip-internal       { background: #EAEAEA; color: #555; }
.chip-p-urgent { background: var(--st-red); color: var(--white); }
.chip-p-high   { background: #FBEFEF; color: var(--st-red); }
.chip-p-low    { background: #EAEAEA; color: var(--muted); }

/* ---- Tables ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 0.95rem;
}
.table th {
    background: var(--pale-2);
    text-align: right;
    padding: 10px 12px;
    color: var(--forest-dark);
}
.table td { padding: 10px 12px; border-top: 1px solid var(--line); }

/* ---- Ticket thread ---- */
.msg {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.msg-internal { background: #FFF9E6; border-color: #E8DCA8; }
.msg-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.msg-head strong { color: var(--ink); }
.filelist { margin: 0; padding-right: 18px; }
.filelist li { margin-bottom: 6px; }

/* ---- Users ---- */
.userrow {
    border-top: 1px solid var(--line);
    padding: 10px 0;
}
.userrow:first-of-type { border-top: none; }
.userrow > summary {
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* ---- Client dashboard ---- */
.cards-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
}
.stat-attention { border-color: var(--st-orange); }
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--forest-dark); }
.stat-label { color: var(--muted); font-size: 0.92rem; }

/* ---- 2FA setup ---- */
.steps { padding-right: 20px; }
.steps li { margin-bottom: 6px; }
.qr-wrap { text-align: center; margin: 18px 0; }
.qr-wrap #qr { display: inline-block; padding: 12px; background: var(--white); }
.secret {
    font-family: 'Courier New', monospace;
    direction: ltr;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    background: var(--pale);
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .board { display: flex; overflow-x: auto; padding-bottom: 8px; }
    .col { min-width: 260px; flex: 0 0 260px; }
    .grid-2 { grid-template-columns: 1fr; }
    .cards-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .topbar-inner { gap: 14px; padding: 0 14px; }
    .user-name { display: none; }
    .auth-card { padding: 26px 20px 22px; }
    .table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
