/* =====================================================================
   OST Dashboard — design tokens & utility layer
   Loaded AFTER tailwind.css so these win on equal specificity.
   The bundled tailwind build is pre-compiled (no JIT), so the custom
   palette and arbitrary-value utilities are defined here by hand.
   ===================================================================== */

:root {
    --ink:        #12151C;
    --muted:      #6B7280;
    --faint:      #9AA1AC;
    --bg:         #F2F3F6;
    --line:       #E4E7ED;

    --forest-50:  #EEF4F1;
    --forest-100: #DCE9E3;
    --forest-300: #7FA396;
    --forest-500: #2F5D50;
    --forest-600: #24463D;
    --forest-700: #1A332C;
    --forest-800: #132821;

    --amber-50:   #FCF3E3;
    --amber-300:  #EBB05B;
    --amber-500:  #D98C2B;
    --amber-600:  #B36F1D;

    --shadow-card: 0 1px 2px rgba(18,21,28,.04), 0 1px 12px rgba(18,21,28,.05);
    --shadow-pop:  0 8px 24px rgba(18,21,28,.10);
}

body { font-feature-settings: "ss01"; }
::selection { background: var(--forest-100); color: var(--forest-700); }

/* The bundled tailwind.css ships a trimmed preflight that omits the
   `border-style: solid` default, so the border and divide utilities set a
   width but computed to 0px (style stayed `none`). Restore the style on the
   utilities themselves rather than on `*`, so osTicket's own widgets
   (select2, jQuery UI, redactor) keep their native borders. */
.border, .border-0, .border-2, .border-4, .border-8 { border-style: solid; }
/* directional utilities must only affect their own edge */
.border-t, .border-t-2, .border-t-4 { border-top-style: solid; }
.border-r, .border-r-2, .border-r-4 { border-right-style: solid; }
.border-b, .border-b-2, .border-b-4 { border-bottom-style: solid; }
.border-l, .border-l-2, .border-l-4 { border-left-style: solid; }
.divide-y > * + * { border-top-style: solid; }
.divide-x > * + * { border-left-style: solid; }
.border-dashed { border-style: dashed; }
.border-none   { border-style: none; }

/* ---------- typography ---------- */
.font-display { font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; }
.font-sans    { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.font-mono    { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

.text-\[10\.5px\] { font-size: 10.5px; }
.text-\[11px\]    { font-size: 11px; }
.text-\[11\.5px\] { font-size: 11.5px; }
.text-\[12px\]    { font-size: 12px; }
.text-\[12\.5px\] { font-size: 12.5px; }
.text-\[13px\]    { font-size: 13px; }
.text-\[13\.5px\] { font-size: 13.5px; }
.text-\[14px\]    { font-size: 14px; }
.text-\[15px\]    { font-size: 15px; }
.h-\[18px\] { height: 18px; }
.w-\[18px\] { width: 18px; }
.min-h-\[140px\] { min-height: 140px; }

/* ---------- colour ---------- */
.text-ink   { color: var(--ink); }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.bg-bg      { background-color: var(--bg); }
.bg-bg\/60  { background-color: rgba(242,243,246,.6); }
.bg-line      { background-color: var(--line); }
.border-line  { border-color: var(--line); }
.border-faint { border-color: var(--faint); }

.bg-forest-50  { background-color: var(--forest-50); }
.bg-forest-100 { background-color: var(--forest-100); }
.bg-forest-500 { background-color: var(--forest-500); }
.bg-forest-600 { background-color: var(--forest-600); }
.bg-forest-700 { background-color: var(--forest-700); }
.bg-forest-50\/40 { background-color: rgba(238,244,241,.4); }
.text-forest-50  { color: var(--forest-50); }
.text-forest-500 { color: var(--forest-500); }
.text-forest-600 { color: var(--forest-600); }
.text-forest-700 { color: var(--forest-700); }
.text-forest-100\/70 { color: rgba(220,233,227,.7); }
.text-forest-100\/80 { color: rgba(220,233,227,.8); }
.border-forest-300 { border-color: var(--forest-300); }
.border-forest-500 { border-color: var(--forest-500); }

.bg-amber-50  { background-color: var(--amber-50); }
.bg-amber-300 { background-color: var(--amber-300); }
.bg-amber-500 { background-color: var(--amber-500); }
.text-amber-500 { color: var(--amber-500); }
.text-amber-600 { color: var(--amber-600); }

.bg-white\/5  { background-color: rgba(255,255,255,.05); }
.bg-white\/10 { background-color: rgba(255,255,255,.10); }
.border-white\/15 { border-color: rgba(255,255,255,.15); }

/* status dot / pill colours used by list + detail */
.bg-sky-50   { background-color: #EFF6FF; }
.text-sky-700{ color: #1D4ED8; }
.bg-sky-500  { background-color: #3B82F6; }
.bg-slate-100{ background-color: #F1F5F9; }
.text-slate-600 { color: #475569; }
.bg-slate-400 { background-color: #94A3B8; }

/* ---------- shadows ---------- */
.shadow-card { box-shadow: var(--shadow-card); }
.shadow-pop  { box-shadow: var(--shadow-pop); }

/* ---------- hover / focus variants ---------- */
.hover\:bg-white\/5:hover   { background-color: rgba(255,255,255,.05); }
.hover\:bg-white\/10:hover  { background-color: rgba(255,255,255,.10); }
.hover\:bg-bg:hover         { background-color: var(--bg); }
.hover\:bg-bg\/60:hover     { background-color: rgba(242,243,246,.6); }
.divide-line > * + *        { border-color: var(--line); }
.min-w-\[200px\]            { min-width: 200px; }
.hover\:bg-forest-700:hover { background-color: var(--forest-700); }
.hover\:bg-forest-50\/40:hover { background-color: rgba(238,244,241,.4); }
.hover\:text-ink:hover      { color: var(--ink); }
.hover\:text-white:hover    { color: #fff; }
.hover\:text-forest-600:hover { color: var(--forest-600); }
.hover\:border-faint:hover  { border-color: var(--faint); }
.hover\:border-forest-300:hover { border-color: var(--forest-300); }

.focus\:border-forest-500:focus { border-color: var(--forest-500); }
.hover\:underline:hover { text-decoration: underline; }
.appearance-none { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
.border-collapse { border-collapse: collapse; }
.min-w-\[720px\] { min-width: 720px; }

/* osticket.js flags "unsaved changes" by setting an inline color:red on the
   submit button — illegible on our solid buttons. Override the colour only;
   the beforeunload warning it installs alongside still works. */
input[type=submit].bg-forest-600,
.dashboard-form-polish input[type=submit],
.dash-form input[type=submit] { color: #fff !important; }

.focus-ring:focus-visible { outline: 2px solid var(--forest-500); outline-offset: 2px; }
.focus-within\:border-forest-500:focus-within { border-color: var(--forest-500); }
.focus-within\:ring-1:focus-within { box-shadow: 0 0 0 1px var(--forest-500); }

/* ---------- layout helpers ---------- */
.max-w-\[900px\]  { max-width: 900px; }
.max-w-\[1400px\] { max-width: 1400px; }
/* Sidebar engages at the md breakpoint (768px) rather than lg, so the
   panel reads as a dashboard on tablets and narrower desktops too. */
.bg-bg\/50 { background-color: rgba(242,243,246,.5); }
@media (min-width: 640px) {
    .sm\:max-w-md { max-width: 28rem; }
    .sm\:grid-cols-\[1fr_auto_1fr\] { grid-template-columns: 1fr auto 1fr; }
}
@media (min-width: 768px) {
    .md\:grid-cols-\[240px_1fr\] { grid-template-columns: 240px 1fr; }
    .md\:grid-cols-\[280px_1fr\] { grid-template-columns: 280px 1fr; }
    .md\:sticky { position: sticky; }
    .md\:top-24 { top: 5.5rem; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-\[240px_1fr\] { grid-template-columns: 240px 1fr; }
    .lg\:sticky { position: sticky; }
    .lg\:top-24 { top: 6rem; }
}
.place-items-center { place-items: center; }
.align-top { vertical-align: top; }
.hover\:text-muted:hover { color: var(--muted); }
.space-y-2\.5 > * + * { margin-top: .625rem; }
.space-y-3 > * + *    { margin-top: .75rem; }
.space-y-3\.5 > * + * { margin-top: .875rem; }
.space-y-5 > * + *    { margin-top: 1.25rem; }
.space-y-6 > * + *    { margin-top: 1.5rem; }

/* ---------- home hero ---------- */
.bg-forest-800 { background-color: var(--forest-800); }
.text-forest-100 { color: var(--forest-100); }
.bg-white\/95 { background-color: rgba(255,255,255,.95); }
.hover\:bg-white:hover { background-color: #fff; }
.hover\:bg-amber-300:hover { background-color: var(--amber-300); }
.hover\:text-forest-700:hover { color: var(--forest-700); }
.hover\:shadow-pop:hover { box-shadow: var(--shadow-pop); }
.group:hover .group-hover\:text-forest-600 { color: var(--forest-600); }
.group:hover .group-hover\:gap-2\.5 { gap: .625rem; }
.max-w-\[1000px\] { max-width: 1000px; }
.max-w-\[1100px\] { max-width: 1100px; }
.text-\[14\.5px\] { font-size: 14.5px; }
.text-\[16px\]   { font-size: 16px; }

/* subtle dot grid over the hero */
.hero-grid {
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.10) 1px, transparent 0);
    background-size: 28px 28px;
}
/* soft colour blooms behind the hero copy */
.hero-blob { position: absolute; border-radius: 9999px; filter: blur(64px); pointer-events: none; }
.hero-blob-a { top: -6rem; right: -6rem; height: 24rem; width: 24rem; background: rgba(47,93,80,.30); }
.hero-blob-b { bottom: -8rem; left: -4rem; height: 20rem; width: 20rem; background: rgba(217,140,43,.10); }

/* ---------- uploaded-file rows (js/filedrop.field.js) ----------
   Markup: .files > .file > [.filetype, img.preview, span.filename >
   (span.filesize, .cancel > i), .progress > .progress-bar, input]
   filedrop.css is injected after this file and styles `.filedrop .files
   .file`, so these selectors carry the page wrapper to outrank it. */
.dash-form .filedrop .files,
.dashboard-reply .filedrop .files {
    margin-top: .75rem; display: flex; flex-direction: column; gap: .5rem;
}
.dash-form .filedrop .files .file,
.dashboard-reply .filedrop .files .file {
    position: relative; display: flex; align-items: center; gap: .75rem;
    border: 1px solid var(--line); border-radius: .5rem; background: #fff;
    padding: .55rem .75rem; margin: 0; height: auto; overflow: hidden;
}
.dash-form .filedrop .files .file:hover,
.dashboard-reply .filedrop .files .file:hover { background: rgba(242,243,246,.6); }
.dash-form .filedrop .files .file .filetype,
.dashboard-reply .filedrop .files .file .filetype { display: none; }
.dash-form .filedrop .files .file img.preview,
.dashboard-reply .filedrop .files .file img.preview {
    width: 34px; height: 34px; object-fit: cover; border-radius: .375rem;
    border: 1px solid var(--line); flex: 0 0 auto; background: var(--bg);
    position: static; margin: 0;
}
.dash-form .filedrop .files .file .filename,
.dashboard-reply .filedrop .files .file .filename {
    flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .5rem;
    font-size: 13px; font-weight: 500; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-form .filedrop .files .file .filename > a,
.dashboard-reply .filedrop .files .file .filename > a { color: var(--ink); text-decoration: none; }
.dash-form .filedrop .files .file .filesize,
.dashboard-reply .filedrop .files .file .filesize {
    font-family: "JetBrains Mono", monospace; font-size: 11.5px;
    font-weight: 400; color: var(--faint); flex: 0 0 auto; position: static;
}
.dash-form .filedrop .files .file .upload-rate,
.dashboard-reply .filedrop .files .file .upload-rate {
    font-family: "JetBrains Mono", monospace; font-size: 11.5px;
    color: var(--faint); margin-left: auto; flex: 0 0 auto;
}
/* the remove control is `.cancel` while uploading and `.trash` once stored —
   .trash is prepended, so order pushes it back to the end of the row */
.dash-form .filedrop .files .file .cancel,
.dash-form .filedrop .files .file .trash,
.dashboard-reply .filedrop .files .file .cancel,
.dashboard-reply .filedrop .files .file .trash {
    order: 9; margin-left: auto; flex: 0 0 auto; cursor: pointer; float: none;
    color: var(--faint); transition: color .15s;
}
.dash-form .filedrop .files .file .cancel:hover,
.dash-form .filedrop .files .file .trash:hover,
.dashboard-reply .filedrop .files .file .cancel:hover,
.dashboard-reply .filedrop .files .file .trash:hover { color: #B4232A; }
/* upload progress runs as a hairline along the bottom of the row */
.dash-form .filedrop .files .file .progress,
.dashboard-reply .filedrop .files .file .progress {
    position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: transparent; margin: 0;
}
.dash-form .filedrop .files .file .progress-bar,
.dashboard-reply .filedrop .files .file .progress-bar {
    height: 2px; background: var(--forest-500); transition: width .2s;
}

/* ---------- form fields (shared by the ticket + status forms) ---------- */
.field-label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--ink); margin-bottom: .4rem;
}
/* scoped to our own labels — osTicket also emits <span class="required">,
   which already carries its own asterisk */
.field-label.required::after,
.required-legend::after { content: '*'; color: var(--amber-600); margin-left: 3px; }
.field-error { color: #B4232A; font-size: 12px; margin-top: .35rem; }
.field-input {
    width: 100%; height: 2.75rem; padding: 0 .875rem;
    border-radius: .5rem; border: 1px solid var(--line); font-size: 13.5px;
    color: var(--ink); background: #fff; box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
    outline: none; border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(47,93,80,.12);
}
.field-input::placeholder { color: var(--faint); }
/* .field-input sets the `padding` shorthand, which would otherwise beat the
   pl-/pr- utilities used to make room for a leading icon or trailing chevron */
.field-input.pl-10 { padding-left: 2.5rem; }
.field-input.pr-9  { padding-right: 2.25rem; }

/* ---------- osTicket form markup styled as our design
   (shared by the open-ticket and account-registration forms) ---------- */

/* ---------------------------------------------------------------
   osTicket renders the contact + ticket forms itself (table rows,
   its own labels and widgets), and the AJAX help-topic swap replaces
   #dynamic-form with more of the same markup — so the field styling
   from the reference is applied via CSS rather than by re-templating.
   --------------------------------------------------------------- */
.dash-form input[type=text],
.dash-form input[type=email],
.dash-form input[type=tel],
.dash-form input[type=password],
.dash-form input[type=number],
.dash-form select,
.dash-form textarea {
    width: 100%; height: 2.75rem; padding: 0 .875rem;
    border-radius: .5rem; border: 1px solid var(--line); font-size: 13.5px;
    color: var(--ink); background: #fff; box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.dash-form textarea { height: auto; padding: .75rem .875rem; }
.dash-form input:focus,
.dash-form select:focus,
.dash-form textarea:focus {
    outline: none; border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(47,93,80,.12);
}
.dash-form input::placeholder,
.dash-form textarea::placeholder { color: var(--faint); }

/* core lays fields out in table rows — flatten them into stacked blocks */
.dash-form table, .dash-form tbody,
.dash-form tr, .dash-form td { display: block; width: 100%; }
.dash-form td { padding: 0 0 1.25rem; }
.dash-form tr:last-child td { padding-bottom: 0; }

/* contact details sit two-up on desktop (email + full name on one row) */
@media (min-width: 640px) {
    .dash-hide-form-header tbody {
        display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem;
    }
    .dash-hide-form-header tbody > tr:first-child { grid-column: 1 / -1; }
    .dash-hide-form-header td { padding-bottom: 1.25rem; }
}

/* core's field label is <label><span>Text <span class="error">*</span></span><br/>widget</label> */
.dash-form label { display: block; }
.dash-form label > span:first-child {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--ink); margin-bottom: .4rem;
}
/* core puts a <br> between the label text and the widget — the block
   label above already provides that break */
.dash-form label > br { display: none; }
.dash-form label span.error { color: var(--amber-600); }
.dash-form div.error { color: #B4232A; font-size: 12px; margin-top: .35rem; }
.dash-form label em,
.dash-form em[style] {
    display: block; color: var(--faint) !important; font-size: 12px;
    font-style: normal; margin: -.15rem 0 .4rem;
}

/* per-form headers coming from the dynamic form */
.dash-form .form-header { margin-bottom: 1.25rem; }
.dash-form .form-header h3 {
    font-family: "Space Grotesk", sans-serif; font-size: 13.5px; font-weight: 600;
    color: var(--ink); margin: 0 0 .2rem;
}
.dash-form .form-header div { font-size: 12.5px; color: var(--muted); }
/* the contact form's own title duplicates our numbered section heading */
.dash-hide-form-header .form-header h3 { display: none; }
/* core emits an <hr> above each form header — hide only those, not the
   section separators we place between the numbered steps */
.dash-form table hr { display: none; }

/* phone number + extension stay on one row even in a half-width column */
.dash-form input[type=tel] {
    width: calc(100% - 8.5rem); min-width: 6rem; display: inline-block;
}
.dash-form input[name$="-ext"] {
    width: 4.5rem; display: inline-block; margin-left: .4rem; text-align: center;
}

/* rich-text editor + attachment drop zone */
.dash-form .redactor-box {
    border: 1px solid var(--line); border-radius: .5rem; overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.dash-form .redactor-box:focus-within {
    border-color: var(--forest-500); box-shadow: 0 0 0 3px rgba(47,93,80,.12);
}
.dash-form .redactor-toolbar {
    background: rgba(242,243,246,.6) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: .3rem .5rem !important;
}
.dash-form .redactor-toolbar a { color: var(--muted) !important; border-radius: .375rem; }
.dash-form .redactor-toolbar a:hover { background: #fff !important; color: var(--ink) !important; }
.dash-form .redactor-in { min-height: 150px; font-size: 14px; color: var(--ink); }
.dash-form .redactor-box textarea { border: none; box-shadow: none; }
.dash-form .dropzone {
    border: 2px dashed var(--line) !important; border-radius: .75rem;
    background: #fff; color: var(--muted); font-size: 13px;
    padding: 1.25rem !important; text-align: center; margin-top: 1rem;
    transition: border-color .15s, background .15s;
}
.dash-form .dropzone:hover {
    border-color: var(--forest-300) !important; background: rgba(238,244,241,.4);
}
.dash-form .dropzone a { color: var(--forest-600); font-weight: 500; }

/* ---------- notice banners ---------- */
.banner-err  { background: #FDF0F0; color: #B4232A; border-color: #F3D4D6; }
.banner-warn { background: var(--amber-50); color: var(--amber-600); border-color: #F0DFC2; }
.banner-note { background: var(--forest-50); color: var(--forest-700); border-color: var(--forest-100); }

/* ---------- conversation timeline rail ---------- */
.rail { position: relative; }
.rail::before {
    content: '';
    position: absolute;
    top: 40px; bottom: -32px; left: 19px;
    width: 2px;
    background: linear-gradient(to bottom, var(--forest-100), var(--line) 85%);
}
.rail:last-child::before { display: none; }
