/* ============================================================
   AKIID MUSIQ ARTIST CMS
   Admin stylesheet
   Developed by Esomthathi Group

   Palette taken from the artist's own press assets:
   the near-black cover, the oxblood About page, the pale
   steel blue of the logo mark.
   ============================================================ */

:root {
    --ink:        #0b0b0d;
    --panel:      #141418;
    --panel-high: #1c1c22;
    --line:       #2a2a32;
    --oxblood:    #8e2230;
    --oxblood-lt: #b8404f;
    --steel:      #c6d3de;
    --ash:        #7a828c;
    --bone:       #f2f3f5;
    --good:       #3f9e6a;
    --wait:       #c08a2e;

    --rail: 232px;
    --radius: 3px;

    --font-display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--ink);
    color: var(--steel);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--steel); text-decoration: none; }
a:hover { color: var(--bone); }

:focus-visible {
    outline: 2px solid var(--oxblood-lt);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   TYPE
   ------------------------------------------------------------ */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--bone);
    margin: 0 0 0.4em;
    line-height: 1.15;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.eyebrow {
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ash);
    margin: 0 0 0.35rem;
}

.muted { color: var(--ash); }
.small { font-size: 0.82rem; }

/* ------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------ */

.shell { display: flex; min-height: 100vh; }

.rail {
    width: var(--rail);
    flex: 0 0 var(--rail);
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    /* The menu scrolls, the rail itself does not. With twenty items the
       whole rail used to scroll, which pushed Sign out off the bottom
       where nobody could find it. */
    overflow: hidden;
}

.rail-nav { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.rail-foot { flex: 0 0 auto; }

.rail-brand {
    padding: 1.4rem 1.25rem 1.1rem;
    border-bottom: 1px solid var(--line);
}

.rail-brand .name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--bone);
    display: block;
}

.rail-brand .sub {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ash);
}

.rail-nav { padding: 0.9rem 0; flex: 1; }

.rail-group {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ash);
    padding: 1rem 1.25rem 0.4rem;
}

.rail-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    color: var(--steel);
    border-left: 2px solid transparent;
}

.rail-nav a:hover { background: var(--panel-high); }

.rail-nav a.on {
    background: var(--panel-high);
    border-left-color: var(--oxblood);
    color: var(--bone);
    font-weight: 500;
}

/* Modules that are not built yet. Shown so the shape of the finished
   system is visible, but not clickable, so nobody lands on a 404. */
.rail-soon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    color: var(--ash);
    border-left: 2px solid transparent;
    cursor: default;
}

.rail-soon .pill { font-size: 0.6rem; padding: 0.1rem 0.4rem; }

.rail-foot {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--ash);
}

.main { flex: 1; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.topbar .who { font-size: 0.85rem; color: var(--ash); }
.topbar .who strong { color: var(--steel); font-weight: 500; }

.content { padding: 1.75rem; max-width: 1180px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

/* ------------------------------------------------------------
   PANELS AND GRIDS
   ------------------------------------------------------------ */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.panel + .panel { margin-top: 1.25rem; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Metric tiles */
.tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    position: relative;
    overflow: hidden;
}

.tile::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: var(--line);
}

.tile.flag::after { background: var(--oxblood); }

.tile .figure {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--bone);
    line-height: 1;
    letter-spacing: -0.02em;
}

.tile .label {
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ash);
    margin-top: 0.45rem;
}

/* ------------------------------------------------------------
   TABLES
   ------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.data th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ash);
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tbody tr:hover { background: var(--panel-high); }
table.data td.tight { white-space: nowrap; }

/* ------------------------------------------------------------
   PILLS
   ------------------------------------------------------------ */

.pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    border: 1px solid;
}

.pill-alert { color: var(--oxblood-lt); border-color: rgba(184, 64, 79, 0.45); background: rgba(142, 34, 48, 0.15); }
.pill-good  { color: var(--good);      border-color: rgba(63, 158, 106, 0.45); background: rgba(63, 158, 106, 0.12); }
.pill-wait  { color: var(--wait);      border-color: rgba(192, 138, 46, 0.45); background: rgba(192, 138, 46, 0.12); }
.pill-off   { color: var(--ash);       border-color: var(--line);              background: var(--panel-high); }

/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel-high);
    color: var(--steel);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: var(--line); color: var(--bone); }

.btn-primary {
    background: var(--oxblood);
    border-color: var(--oxblood);
    color: var(--bone);
}

.btn-primary:hover { background: var(--oxblood-lt); border-color: var(--oxblood-lt); color: #fff; }

.btn-ghost { background: transparent; }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.7rem; }
.btn-danger { color: var(--oxblood-lt); border-color: rgba(184, 64, 79, 0.4); }
.btn-danger:hover { background: var(--oxblood); color: #fff; border-color: var(--oxblood); }

/* ------------------------------------------------------------
   FORMS
   ------------------------------------------------------------ */

.field { margin-bottom: 1.1rem; }

.field label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ash);
    margin-bottom: 0.4rem;
}

.field .hint {
    font-size: 0.78rem;
    color: var(--ash);
    margin-top: 0.35rem;
}

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=url], select, textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--bone);
    font-family: inherit;
    font-size: 0.92rem;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--oxblood-lt);
    outline: none;
}

textarea { min-height: 140px; resize: vertical; line-height: 1.6; }

/* ------------------------------------------------------------
   FLASH MESSAGES
   ------------------------------------------------------------ */

.flash {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    border-left: 3px solid;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.flash-success { background: rgba(63, 158, 106, 0.1);  border-color: var(--good); color: #a8dcc0; }
.flash-error   { background: rgba(142, 34, 48, 0.16); border-color: var(--oxblood); color: #eab5bc; }
.flash-info    { background: var(--panel-high);        border-color: var(--ash); color: var(--steel); }

/* ------------------------------------------------------------
   EMPTY STATES
   ------------------------------------------------------------ */

.empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ash);
}

.empty h3 { color: var(--steel); }
.empty p { max-width: 30rem; margin: 0.4rem auto 1.2rem; }

/* ------------------------------------------------------------
   LOGIN
   The groove rings echo the vinyl mark inside the Akiid logo.
   ------------------------------------------------------------ */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 50% 45%, rgba(142, 34, 48, 0.22), transparent 55%),
        var(--ink);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 1.9rem;
    position: relative;
}

.groove {
    width: 66px;
    height: 66px;
    margin: 0 auto 1.4rem;
    border-radius: 50%;
    background:
        radial-gradient(circle, var(--oxblood) 0 14%, transparent 14%),
        repeating-radial-gradient(circle, var(--line) 0 1px, transparent 1px 5px);
    border: 1px solid var(--line);
}

.login-card h1 {
    text-align: center;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.login-card .sub {
    text-align: center;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ash);
    margin-bottom: 1.8rem;
}

.login-card .btn { width: 100%; justify-content: center; }

.login-foot {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ash);
}

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   THE TOP BAR AND THE DRAWER
   Only on a phone. The old rule turned the menu into a flat list, and
   with twenty links that filled the screen before any of the page
   showed. A drawer keeps the page in front and the menu one tap away.
   ------------------------------------------------------------ */

/* Only the mobile bar is hidden on a desktop. The bar holding "Signed in
   as" and the Sign out button shares the page with it and must stay. */
.mobilebar { display: none; }
.rail-veil { display: none; }

@media (max-width: 900px) {
    .content { padding: 1.25rem; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .mobilebar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 60;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.6rem 0.9rem;
        background: var(--panel);
        border-bottom: 1px solid var(--line);
    }

    .mobilebar-toggle,
    .mobilebar-home {
        flex: 0 0 auto;
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 1px solid var(--line);
        background: transparent;
        color: var(--bone);
        cursor: pointer;
    }
    .mobilebar-toggle svg, .mobilebar-home svg { width: 20px; height: 20px; }
    .mobilebar-home svg { fill: currentColor; }
    .mobilebar-toggle:active { background: var(--panel-high); }

    .mobilebar-title {
        flex: 1 1 auto;
        min-width: 0;
        font-family: var(--font-display);
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--bone);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .shell { display: block; }

    .rail {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(290px, 84vw);
        max-width: none;
        flex: none;
        z-index: 80;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-100%);
        transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.3, 1);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
        border-right: 1px solid var(--line);
    }
    .rail.open { transform: translateX(0); }

    .rail-veil {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    .rail-veil[hidden] { display: none; }

    body.rail-open { overflow: hidden; }

    /* Back to a proper vertical list inside the drawer, with rows big
       enough to hit with a thumb. */
    .rail-nav { padding: 0.5rem 0 1.5rem; display: block; }
    .rail-group { display: block; }

    .rail-nav a,
    .rail-soon {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.85rem 1.1rem;
        border-left: 3px solid transparent;
        border-bottom: none;
        font-size: 0.95rem;
    }
    .rail-nav a.on { border-left-color: var(--oxblood); border-bottom: none; }

    .rail-foot { display: block; padding: 1rem 1.1rem; border-top: 1px solid var(--line); }

    .content { padding: 1rem; }

    .page-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .page-head h1 { font-size: 1.6rem; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .panel { padding: 1rem; }
    .panel-head { flex-direction: column; align-items: flex-start; gap: 0.6rem; }

    /* Wide tables scroll on their own rather than squashing the page. */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data { min-width: 560px; }

    .field input, .field select, .field textarea { font-size: 16px; }  /* stops iOS zooming in */

    .btn { padding: 0.7rem 1.1rem; }
    .btn-sm { padding: 0.55rem 0.85rem; }
}

@media (max-width: 480px) {
    .rail { width: min(280px, 88vw); }
    .content { padding: 0.85rem; }
    .tile .figure { font-size: 1.6rem; }
}

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

/* ------------------------------------------------------------
   PAGING
   ------------------------------------------------------------ */

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 0;
    margin-top: 1rem;
    border-top: 1px solid var(--line);
}
.pager-count { font-size: 0.82rem; color: var(--ash); }
.pager-links { display: flex; gap: 0.5rem; align-items: center; }
.pager-page { font-size: 0.8rem; color: var(--ash); padding: 0 0.4rem; }
.btn.is-off { opacity: 0.35; pointer-events: none; }

@media (max-width: 620px) {
    .pager { justify-content: center; }
}

/* ------------------------------------------------------------
   ONE SAVE PER SECTION
   Each panel on Settings saves on its own, so changing the colours
   never means resubmitting the SMTP password alongside it.
   ------------------------------------------------------------ */

.panel-save {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 620px) {
    .panel-save { justify-content: stretch; }
    .panel-save .btn { width: 100%; justify-content: center; }
}

/* The code box, wide and spaced so six digits are easy to read back. */
.code-input {
    letter-spacing: 0.55em;
    text-indent: 0.55em;
    font-size: 1.35rem;
    text-align: center;
    font-family: var(--font-display);
}

@media (max-width: 420px) {
    .code-input { letter-spacing: 0.35em; text-indent: 0.35em; font-size: 1.15rem; }
}
