/* ──────────────────────────────────────────────────────────────────────────
   Shared controls for the staff app: the primary button and the text field.

   Every page used to spell these out in utility classes, and they had
   drifted: four primary-button colours, two focus-ring colours, two corner
   radii, two paddings. A page now says `rs-btn-primary` or `rs-field` and
   the look is decided here, once. The custom dropdown (dropdown.css) uses
   the same border, radius and focus ring, so a select and a text box sitting
   side by side match.

   The rules sit in Tailwind's `components` layer, below `utilities`, so a
   utility on the element (pl-10 to make room for an icon, w-full, px-6 for
   a wider button) still wins. Plain CSS in its own file, like dropdown.css:
   nothing here needs the Tailwind bundle rebuilt.
   ────────────────────────────────────────────────────────────────────────── */

@layer components {
    :root {
        --rs-primary: #334155;          /* the dark slate of "Create Request" */
        --rs-primary-hover: #1e293b;
        --rs-field-border: #d1d5db;
        --rs-field-focus: #6b7280;
    }

    .rs-btn-primary {
        background-color: var(--rs-primary);
        color: #fff;
        font-size: 0.875rem; line-height: 1.25rem;
        border-radius: 0.25rem;
        transition: background-color .15s;
    }
    .rs-btn-primary:hover { background-color: var(--rs-primary-hover); }
    .rs-btn-primary:focus-visible { outline: 2px solid var(--rs-field-focus); outline-offset: 2px; }
    .rs-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

    .rs-field {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem; line-height: 1.25rem;
        color: #111827;
        background-color: #fff;
        border: 1px solid var(--rs-field-border);
        border-radius: 0.25rem;
        outline: none;
        transition: border-color .15s, box-shadow .15s;
    }
    .rs-field::placeholder { color: #9ca3af; }
    .rs-field:hover { border-color: #9ca3af; }
    .rs-field:focus { border-color: var(--rs-field-focus); box-shadow: 0 0 0 2px rgba(107, 114, 128, .25); }
    .rs-field:disabled, .rs-field[readonly] { background-color: #f9fafb; color: #6b7280; }
}

/* Dark mode. theme.css already recolours inputs; the button needs its own
   treatment. */
/* theme.css recolours link and button text in dark mode with !important
   (it keys off bg-* and text-white classes, which these buttons no longer
   carry), so both colours have to be pinned here or the label vanishes. */
.dark .rs-btn-primary { background-color: #475569 !important; color: #fff !important; }
.dark .rs-btn-primary:hover { background-color: #5a6b82 !important; }
.dark .rs-btn-accent { background-color: #d2600f !important; color: #fff !important; }
.dark .rs-btn-accent:hover { background-color: #e06a14 !important; }
.dark .rs-field:hover { border-color: rgba(255, 255, 255, .3) !important; }
.dark .rs-field:focus { border-color: rgba(255, 255, 255, .35) !important; box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }

/* ──────────────────────────────────────────────────────────────────────────
   House polish: a few small touches borrowed from the customer portal,
   applied over the existing layout rather than replacing it.
   ────────────────────────────────────────────────────────────────────────── */

/* A flat light grey ground instead of the diagonal gradient, so white
   panels read as panels. */
html:not(.dark) .bg-gradient-to-br { background-image: none !important; background-color: #f3f4f6 !important; }

/* Panels: squarer corners and a quieter shadow. */
main .bg-white.rounded-lg { border-radius: 0.25rem; }
main .bg-white.rounded-lg.shadow { box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* Column headings set wide, the way section headings are on the portal. */
main th { letter-spacing: 0.06em; }

/* The page you are on gets the brand orange down its edge. */
nav a.bg-gray-100.font-medium { box-shadow: inset 3px 0 0 #f07d36; }

/* Readable greys. Most of the app's secondary text (labels, column headings,
   dates, counts, empty values) was a pale grey that only just cleared, or
   missed, the contrast needed to read comfortably at 12-14px on white, which
   made whole screens look washed out. Shift each grey one step darker in
   light mode. Dark mode has its own palette in theme.css. */
html:not(.dark) .text-gray-400 { color: #6a7282 !important; }
html:not(.dark) .text-gray-500, html:not(.dark) .text-slate-500 { color: #4a5565 !important; }
html:not(.dark) .text-gray-600 { color: #364153 !important; }
html:not(.dark) .rs-trigger-label.is-placeholder { color: #6a7282; }
html:not(.dark) ::placeholder { color: #7a8391 !important; opacity: 1; }

/* The top bar in the brand blue, the same blue as the customer portal's
   title band. Its drop-down menus stay white. Dark mode keeps its own bar. */
html:not(.dark) .rs-topbar { background-color: #003594 !important; border-bottom-color: #003594 !important; }
html:not(.dark) .rs-topbar :is(button, p, span):not(.header-menu, .header-menu *) { color: #fff !important; }
html:not(.dark) .rs-topbar svg:not(.header-menu *) { color: #c9d6f2 !important; }
html:not(.dark) .rs-topbar button:not(.header-menu *):hover { background-color: rgba(255, 255, 255, .14) !important; }
html:not(.dark) .rs-topbar span.bg-gray-200 { background-color: rgba(255, 255, 255, .3) !important; }
/* A ring so the avatar reads against the bar whatever colour the user chose,
   and its initials stay white in both themes (dark mode greyed them). */
.rs-topbar button > .rounded-full { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); color: #fff !important; }

/* The one action the app is for. Brand orange, so it is the first thing the
   eye finds under the blue bar; deepened slightly from the logo's orange so
   white text stays readable on it. */
@layer components {
    .rs-btn-accent {
        background-color: #d2600f;
        color: #fff;
        font-size: 0.875rem; line-height: 1.25rem;
        border-radius: 0.25rem;
        transition: background-color .15s;
    }
    .rs-btn-accent:hover { background-color: #b24f09; }
    .rs-btn-accent:focus-visible { outline: 2px solid #6b7280; outline-offset: 2px; }
}

/* One blue only. The ticket's details panel was built on Tailwind's "slate"
   greys, which lean blue, so its header read as a second, paler blue beside
   the top bar. Bring those surfaces and rules back to neutral grey. */
html:not(.dark) .theme-sidebar-header { background-color: #f3f4f6 !important; }
html:not(.dark) .bg-slate-50 { background-color: #f9fafb !important; }
html:not(.dark) .bg-slate-100 { background-color: #f3f4f6 !important; }
html:not(.dark) .hover\:bg-slate-50:hover { background-color: #f9fafb !important; }
html:not(.dark) .hover\:bg-slate-100:hover { background-color: #f3f4f6 !important; }
html:not(.dark) .theme-sidebar, html:not(.dark) .border-slate-200, html:not(.dark) .border-slate-300 { border-color: #e5e7eb !important; }
html:not(.dark) .text-slate-900 { color: #101828 !important; }
html:not(.dark) .text-slate-700, html:not(.dark) .text-slate-600 { color: #364153 !important; }
html:not(.dark) .text-slate-400 { color: #6a7282 !important; }

/* theme.css pins the sidebar's Create Request button and the mobile menu's
   links by id in dark mode; match that weight so the button stays orange
   with a white label there too. */
html.dark #sidebar a#create-btn.rs-btn-accent,
html.dark #create-btn.rs-btn-accent { background-color: #d2600f !important; color: #fff !important; }
html.dark #sidebar a#create-btn.rs-btn-accent:hover,
html.dark #create-btn.rs-btn-accent:hover { background-color: #e06a14 !important; }
html.dark #mobile-nav a.rs-btn-accent,
html.dark #mobile-nav a.rs-btn-primary { color: #fff !important; }

/* ──────────────────────────────────────────────────────────────────────────
   Staff sign-in and two-factor pages.

   The same frame as the customer portal's sign-in, so the two read as one
   company: the brand blue edge to edge with the logo's signal rings rising
   from the corner, the white-lettered logo above, and the form as the one
   white card. Here the logo is Rockstar's and the card says it is for staff.
   ────────────────────────────────────────────────────────────────────────── */
.rs-auth {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding: 0 1.5rem;
    color: #fff;
    background-color: #003594;
    background-image:
        repeating-radial-gradient(circle at 100% 100%, transparent 0 4.5rem, rgba(255, 255, 255, .05) 4.5rem 7rem),
        linear-gradient(160deg, #0a45ad 0%, #003594 45%, #00256b 100%);
}
.rs-auth-in { flex: 1 0 auto; width: 100%; max-width: 24rem; display: flex; flex-direction: column; justify-content: center; padding: 3rem 0 2rem; }
.rs-auth-logo { display: block; height: 2.75rem; width: auto; max-width: 80%; margin: 0 auto; }
.rs-auth-tag { margin: 0.875rem 0 2rem; text-align: center; font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase; color: #dbe4f7; }
.rs-auth-card {
    padding: 2rem;
    background: #fff; color: #111827;
    border-top: 5px solid #f07d36; border-radius: 0.25rem;
    box-shadow: 0 18px 40px rgba(0, 10, 40, .35);
}
/* The bot check. Keep it inside the card whatever size it renders at. */
.rs-turnstile { max-width: 100%; overflow: hidden; display: flex; justify-content: center; }
.rs-turnstile > * { max-width: 100%; }
.rs-auth-title { margin: 0 0 1.5rem; font-size: 1.375rem; font-weight: 600; color: #111827; }
.rs-auth-title + .rs-auth-sub { margin: -1rem 0 1.5rem; font-size: 0.875rem; color: #4a5565; }
.rs-auth-footer {
    flex: none; width: 100%; max-width: 72rem; padding: 1.25rem 0 1.5rem;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, .2);
    font-size: 0.875rem; color: #dbe4f7;
}
.rs-auth-footer img { display: block; height: 2.25rem; width: auto; }
.rs-auth-footer a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.rs-auth-footer a:hover { color: #fdba74; }
.rs-auth-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
@media (max-width: 640px) {
    .rs-auth { padding: 0 1rem; }
    .rs-auth-in { padding: 2.25rem 0 1.5rem; }
    .rs-auth-card { padding: 1.5rem 1.25rem; }
    .rs-auth-footer { justify-content: center; text-align: center; }
    .rs-auth-footer nav { justify-content: center; }
}
/* On the narrowest common phones (360px), trim the gutters so the card's
   inside is still 300px wide and the bot check can use its normal shape. */
@media (max-width: 400px) {
    .rs-auth { padding: 0 0.75rem; }
    .rs-auth-card { padding: 1.5rem 1rem; }
}

/* Section tabs in the top bar: plain words, the current one underlined in
   the logo's orange. Dark mode keeps its own grey bar, so the colours are
   set for both. */
.rs-tabs { gap: 0.25rem; margin-left: 0.25rem; }
.rs-tab {
    display: flex; align-items: center; position: relative;
    padding: 0 0.75rem; font-size: 0.9375rem; font-weight: 500; white-space: nowrap;
    color: #d5def3 !important; transition: color .15s, background-color .15s;
}
.rs-tab:hover { color: #fff !important; background-color: rgba(255, 255, 255, .08); }
.rs-tab.is-current { color: #fff !important; }
.rs-tab.is-current::after {
    content: ''; position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0;
    height: 3px; border-radius: 3px 3px 0 0; background: #f07d36;
}
.rs-tab:focus-visible { outline: 2px solid #fff; outline-offset: -4px; border-radius: 4px; }
html.dark .rs-tab { color: #a8a8a8 !important; }
html.dark .rs-tab:hover, html.dark .rs-tab.is-current { color: #f2f2f2 !important; }

/* Quick links to the other tools: small white tiles so each logo reads on
   the blue (and on the dark bar). */
.rs-quick a { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 6px; transition: background-color .15s; }
.rs-quick a:hover { background-color: rgba(255, 255, 255, .14); }
.rs-quick img { max-width: 1.375rem; max-height: 1.375rem; object-fit: contain; }

/* A received email, shown as sent inside a sealed frame (app/email_view.py).
   White in both themes, as in a mail app: emails are designed for white. */
.email-frame {
    display: block; width: 100%; height: 120px; border: 1px solid #e5e7eb;
    border-radius: 8px; background: #fff; color-scheme: light;
}
html.dark .email-frame { border-color: #333; }
