/* Overrides on top of the SmartHR theme. Kept small and additive so the vendor
   stylesheet can be replaced wholesale when the template is updated. */

/* ---------------------------------------------------------------------------
   Colour tokens.

   Eight hues plus slate. Each is defined once as a hue/tint/ink triple, and every
   coloured thing in the app — chips, pills, avatars, card edges, icon tiles — is built
   from these. Adding a colour means adding one block here, not editing components.
   Dark mode restates only the tints, since saturated hues stay legible on dark.
   --------------------------------------------------------------------------- */
:root {
    --accent-slate:  #64748b;
    --accent-blue:   #2563eb;
    --accent-teal:   #0d9488;
    --accent-green:  #16a34a;
    --accent-amber:  #d97706;
    --accent-orange: #ea580c;
    --accent-red:    #dc2626;
    --accent-purple: #7c3aed;
    --accent-pink:   #db2777;

    /* How strong a soft background is, and how much a solid fill is lightened. */
    --accent-tint: 12%;
    --accent-tint-strong: 18%;
}

:root:not([data-theme="light"]) {
    /* Tints need more presence on a dark background to read at all. */
    --accent-tint: 22%;
    --accent-tint-strong: 30%;
}

[data-theme="dark"] {
    --accent-tint: 22%;
    --accent-tint-strong: 30%;
}

.accent-slate  { --accent: var(--accent-slate); }
.accent-blue   { --accent: var(--accent-blue); }
.accent-teal   { --accent: var(--accent-teal); }
.accent-green  { --accent: var(--accent-green); }
.accent-amber  { --accent: var(--accent-amber); }
.accent-orange { --accent: var(--accent-orange); }
.accent-red    { --accent: var(--accent-red); }
.accent-purple { --accent: var(--accent-purple); }
.accent-pink   { --accent: var(--accent-pink); }

.accent-soft {
    background: rgba(100, 116, 139, .12);
    background: color-mix(in srgb, var(--accent) var(--accent-tint), transparent);
    color: var(--accent);
}

.accent-solid {
    background: var(--accent);
    color: #fff;
}

.accent-text {
    color: var(--accent);
}

.accent-edge {
    border-left: 3px solid var(--accent);
}

/* Status pills. Built on the same tokens so a colour means one thing everywhere. */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    background: rgba(100, 116, 139, .12);
    background: color-mix(in srgb, var(--accent, var(--accent-slate)) var(--accent-tint), transparent);
    color: var(--accent, var(--accent-slate));
}

.status-pill::before {
    content: "";
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-neutral  { --accent: var(--accent-slate); }
.status-info     { --accent: var(--accent-blue); }
.status-progress { --accent: var(--accent-teal); }
.status-success  { --accent: var(--accent-green); }
.status-warning  { --accent: var(--accent-amber); }
.status-danger   { --accent: var(--accent-red); }

/* A small chip carrying a type or a role, used inside tables. */
.tag {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .5rem;
    border-radius: .35rem;
    font-size: .72rem;
    font-weight: 500;
    white-space: nowrap;
    background: rgba(100, 116, 139, .12);
    background: color-mix(in srgb, var(--accent, var(--accent-slate)) var(--accent-tint), transparent);
    color: var(--accent, var(--accent-slate));
}

.tag > i { font-size: .85em; }

/* Initials avatar. Colour is derived from the name, so it is stable without storing it. */
.initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    flex-shrink: 0;
    background: rgba(100, 116, 139, .18);
    background: color-mix(in srgb, var(--accent, var(--accent-slate)) var(--accent-tint-strong), transparent);
    color: var(--accent, var(--accent-slate));
}

.initials-lg {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.1rem;
}

/* Icon tile for stat cards. */
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: rgba(100, 116, 139, .12);
    background: color-mix(in srgb, var(--accent, var(--accent-slate)) var(--accent-tint), transparent);
    color: var(--accent, var(--accent-slate));
}

/* Stat cards carry a coloured top rule so a row of them is scannable. */
.stat-card {
    border-top: 3px solid var(--accent, var(--accent-slate));
}

/* Empty-state panel shown by list pages before any data exists. */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state .empty-state-icon {
    font-size: 2.5rem;
    opacity: .35;
    margin-bottom: .75rem;
    display: block;
}

/* Links from one record to another. Subtle until hovered, so a table of them does not
   read as a wall of blue. */
.entity-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border-bottom: 1px dotted transparent;
}

.entity-link:hover,
.entity-link:focus-visible {
    color: var(--bs-primary);
    border-bottom-color: currentColor;
}

.entity-link > i {
    font-size: .95em;
    opacity: .5;
}

.entity-link:hover > i {
    opacity: 1;
}

/* The reference field that opens the picker modal. */
.entity-picker .picker-box {
    cursor: pointer;
    min-height: 48px;
    gap: .5rem;
}

.entity-picker .picker-box:hover,
.entity-picker .picker-box:focus-visible {
    border-color: var(--bs-primary);
}

.entity-picker .picker-clear {
    line-height: 1;
}

.picker-results .picker-row {
    text-align: left;
    cursor: pointer;
}

.min-w-0 {
    min-width: 0;
}

/* Menu entries for modules that have not been built yet. Visible so the shape of the
   system is clear, but plainly not clickable. */
.nav-not-ready {
    opacity: .45;
    cursor: default;
    display: flex;
    align-items: center;
}

/* Crew board. A fortnight of columns has to stay readable, so cells are tight and the
   name column stays put while the dates scroll. */
.crew-board {
    font-size: .8125rem;
}

.crew-board .crew-name-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bs-card-bg, #fff);
    min-width: 170px;
}

.crew-board thead .crew-name-col {
    z-index: 3;
}

.crew-board .crew-cell {
    min-width: 62px;
    vertical-align: top;
    padding: .25rem;
}

.crew-board .crew-weekend {
    background: rgba(108, 117, 125, .06);
}

.crew-board .crew-today {
    box-shadow: inset 0 3px 0 var(--bs-primary);
}

.crew-chip {
    display: block;
    border-radius: .25rem;
    padding: .1rem .3rem;
    margin-bottom: .15rem;
    font-size: .6875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-chip-booked  { background: rgba(25, 135, 84, .16);  color: #146c43; }
.crew-chip-offered { background: rgba(255, 193, 7, .22);  color: #8a6400; }
.crew-chip-leave   { background: rgba(108, 117, 125, .18); color: #52585d; }
.crew-chip-conflict{ background: rgba(220, 53, 69, .18);  color: #b02a37; }

.crew-key {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: .2rem;
    margin-right: .25rem;
    vertical-align: -1px;
}

.crew-key-booked   { background: rgba(25, 135, 84, .5); }
.crew-key-offered  { background: rgba(255, 193, 7, .6); }
.crew-key-leave    { background: rgba(108, 117, 125, .5); }
.crew-key-conflict { background: rgba(220, 53, 69, .5); }


/* Sidebar section headings, tinted so the menu has some structure at a glance. */
.sidebar-menu .menu-title span {
    color: var(--accent-slate);
    letter-spacing: .06em;
}

/* Table rows can carry a left edge in their record's colour. */
tr.accent-edge > td:first-child {
    border-left: 3px solid var(--accent, transparent);
}

/* Picker modal. Wide enough for a grid, and tall enough that the results area does not
   collapse to a couple of rows on a short search. */
.picker-dialog .modal-content {
    min-height: min(34rem, 80vh);
}

.picker-dialog .modal-body {
    min-height: 0;
}

.picker-card {
    display: block;
    width: 100%;
    height: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--bs-border-color, rgba(0, 0, 0, .1));
    border-radius: .5rem;
    background: transparent;
    transition: border-color .12s ease, background-color .12s ease;
}

.picker-card:hover,
.picker-card:focus-visible {
    border-color: var(--bs-primary);
    background: rgba(13, 110, 253, .05);
}

/* Diary month grid. Cells are fixed-height so the grid keeps its shape whether a day
   has one job or five. */
.diary .diary-cell {
    width: 14.28%;
    height: 7.5rem;
    vertical-align: top;
    padding: .25rem;
    overflow: hidden;
}

.diary .diary-date {
    font-size: .75rem;
    font-weight: 600;
    color: var(--accent-slate);
    margin-bottom: .15rem;
}

.diary .diary-other-month {
    background: rgba(108, 117, 125, .04);
}

.diary .diary-other-month .diary-date {
    opacity: .4;
}

.diary .diary-weekend {
    background: rgba(108, 117, 125, .06);
}

.diary .diary-today {
    box-shadow: inset 0 3px 0 var(--bs-primary);
}

.diary-chip {
    display: block;
    border-radius: .25rem;
    padding: .1rem .3rem;
    margin-bottom: .15rem;
    font-size: .6875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(100, 116, 139, .12);
    background: color-mix(in srgb, var(--accent, var(--accent-slate)) var(--accent-tint), transparent);
    color: var(--accent, var(--accent-slate));
}

/* An enquiry is not committed work, so it reads as provisional. */
.diary-chip-tentative {
    border: 1px dashed currentColor;
    background: transparent;
}
