/* =====================================================================
   Admin / Crew back office styling
   ===================================================================== */

/* ---- App shell ------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 258px; background: var(--brand-2); color: #fff;
  display: flex; flex-direction: column; z-index: 50; transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.3rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-name { display: block; font-family: var(--display); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.side-sub { display: block; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-top: 3px; }
.side-nav { flex: 1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: .8rem; padding: .72rem .85rem; border-radius: 11px;
  color: rgba(255,255,255,.72); font-weight: 600; font-size: .93rem; position: relative; transition: .15s;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.side-nav a svg { flex: 0 0 auto; }
.nav-count { margin-left: auto; background: var(--accent); color: #3a2a00; font-size: .72rem; font-weight: 800; padding: .1rem .45rem; border-radius: 999px; font-style: normal; }
.side-foot { padding: .9rem; border-top: 1px solid rgba(255,255,255,.08); }
.side-link { display: flex; align-items: center; gap: .6rem; padding: .6rem .5rem; color: rgba(255,255,255,.7); font-size: .86rem; font-weight: 600; border-radius: 9px; }
.side-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-user { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; padding: .5rem; background: rgba(255,255,255,.05); border-radius: 12px; }
.su-info { flex: 1; overflow: hidden; }
.su-info strong { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-info span { font-size: .72rem; color: rgba(255,255,255,.55); }
.side-user a { color: rgba(255,255,255,.6); padding: 6px; border-radius: 8px; }
.side-user a:hover { color: #fff; background: rgba(255,255,255,.1); }

.app-main { flex: 1; margin-left: 258px; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 0 1.6rem; height: 66px; }
.topbar-title { font-size: 1.25rem; font-weight: 800; }
.topbar-actions { margin-left: auto; }
.menu-btn { display: none; border: 0; background: none; color: var(--ink); }
.app-content { padding: 1.6rem; max-width: 1200px; width: 100%; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(11,17,32,.5); z-index: 45; opacity: 0; pointer-events: none; transition: .2s; }
.sidebar-scrim.show { opacity: 1; pointer-events: auto; }

.flash { margin-bottom: 1rem; padding: .8rem 1.1rem; border-radius: 10px; font-weight: 600; }
.flash-error { background:#fee2e2; color:#b91c1c; }
.flash-ok,.flash-success { background:#dcfce7; color:#15803d; }

.avatar-sm { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: .8rem; flex: 0 0 auto; }
.avatar-md { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-2); color: #fff; font-weight: 800; }
.page-h2 { font-size: 1.35rem; }
.sm { font-size: .8rem; }

/* ---- Dashboard ------------------------------------------------------ */
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { display: flex; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm); }
.stat-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.stat-num { display: block; font-size: 2rem; line-height: 1; font-weight: 800; }
.stat-label { font-size: .82rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 1.05rem; }
.panel-body { padding: .7rem 1.3rem 1.1rem; }
.dash-auction { display: flex; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.dash-auction:last-child { border-bottom: 0; }
.da-date { text-align: center; flex: 0 0 46px; }
.da-date span { font-size: .68rem; text-transform: uppercase; color: var(--brand); font-weight: 800; }
.da-date strong { display: block; font-size: 1.3rem; line-height: 1; }
.da-info { flex: 1; min-width: 0; }
.da-info strong { display: block; }
.da-side { text-align: right; }
.crew-mini { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); }
.dash-msg { display: flex; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.dash-msg:last-child { border-bottom: 0; }
.msg-preview { margin-top: .2rem; font-size: .84rem; }
.msg-time { font-size: .75rem; color: var(--muted); white-space: nowrap; }

/* ---- Toolbars & filters -------------------------------------------- */
.board-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.board-toolbar .search-box { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: .55rem 1rem; color: var(--muted); flex: 1; min-width: 220px; max-width: 360px; }
.board-toolbar .search-box input { border: 0; outline: 0; flex: 1; background: none; }
.board-toolbar .btn { margin-left: auto; }
.seg { display: inline-flex; background: #eef1f7; border-radius: 999px; padding: 3px; }
.seg-btn { border: 0; background: none; padding: .45rem .9rem; border-radius: 999px; font-weight: 700; font-size: .82rem; color: var(--ink-soft); }
.seg-btn.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.legend { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1rem; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.legend-hint { margin-left: auto; font-style: italic; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; margin-right: 5px; vertical-align: -1px; }
.lg-dot.ok { background: var(--ok); } .lg-dot.pending { background: var(--warn); } .lg-dot.declined { background: var(--danger); }
.lg-dot.draft { background: #9ca3af; } .lg-dot.scheduled { background: var(--info); } .lg-dot.completed { background: #a855f7; }

/* ---- Schedule board ------------------------------------------------- */
.schedule-board { display: grid; gap: 1rem; }
.board-loading { display: grid; gap: 1rem; }
.sched-card { display: flex; gap: 1.1rem; background: #fff; border: 1px solid var(--line); border-left: 5px solid #cbd5e1;
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); align-items: center; transition: box-shadow .2s; }
.sched-card:hover { box-shadow: var(--shadow); }
.sched-card.status-confirmed { border-left-color: var(--ok); }
.sched-card.status-scheduled { border-left-color: var(--info); }
.sched-card.status-draft { border-left-color: #9ca3af; }
.sched-card.status-completed { border-left-color: #a855f7; }
.sched-card.status-cancelled { border-left-color: var(--danger); opacity: .7; }
.sched-date { text-align: center; flex: 0 0 58px; }
.sched-date span { font-size: .72rem; text-transform: uppercase; color: var(--brand); font-weight: 800; display: block; }
.sched-date strong { font-size: 1.9rem; line-height: 1; display: block; font-family: var(--display); }
.sched-date .dow { color: var(--muted); }
.sched-main { flex: 1; min-width: 0; }
.sched-title-row { display: flex; align-items: center; gap: .8rem; justify-content: space-between; }
.sched-title-row h3 { font-size: 1.12rem; }
.sched-meta { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .84rem; margin: .4rem 0; }
.sched-meta svg { vertical-align: -2px; }
.sched-crew { display: flex; align-items: center; gap: .6rem; }
.crew-dots { display: inline-flex; gap: 3px; }
.crew-dots .lg-dot { margin: 0; }
.sched-actions { display: flex; flex-direction: column; gap: .4rem; flex: 0 0 auto; }
.status-pill { border: 0; font-weight: 800; font-size: .72rem; text-transform: uppercase; padding: .3rem 1.4rem .3rem .6rem; border-radius: 999px; cursor: pointer; letter-spacing: .03em; }

/* ---- Tables --------------------------------------------------------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfe; }
.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .9rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fafbff; }
.data-table td .muted { font-size: .82rem; }
.row-actions { display: flex; gap: .3rem; justify-content: flex-end; }
.icon-btn { border: 1px solid var(--line); background: #fff; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-soft); transition: .15s; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

/* ---- Modal forms ---------------------------------------------------- */
.modal-form .form-subhead, .form-subhead { margin: 1.2rem 0 .6rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); font-weight: 800; }
.input.color { height: 44px; padding: 4px; }

/* ---- Crew manager --------------------------------------------------- */
.crew-mgr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.crew-mgr-grid h4 { margin-bottom: .8rem; font-size: 1rem; }
.crew-role-group { margin-bottom: 1rem; }
.crew-role-group h5 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .4rem; }
.crew-row { display: flex; align-items: center; gap: .6rem; padding: .5rem; border: 1px solid var(--line); border-radius: 11px; margin-bottom: .4rem; }
.crew-row .muted.sm { display: block; }
.crew-status-seg { display: inline-flex; gap: 3px; }
.cs-btn { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: #fff; cursor: pointer; padding: 0; }
.cs-btn.confirmed { border-color: var(--ok); } .cs-btn.confirmed.on { background: var(--ok); }
.cs-btn.pending { border-color: var(--warn); } .cs-btn.pending.on { background: var(--warn); }
.cs-btn.declined { border-color: var(--danger); } .cs-btn.declined.on { background: var(--danger); }
.add-row { display: flex; align-items: center; gap: .5rem; padding: .55rem .3rem; border-bottom: 1px solid var(--line); }
.add-row.is-unavail { opacity: .65; }
.add-row .role-pick { max-width: 140px; padding: .4rem .5rem; }
.select.sm, .btn.sm { font-size: .82rem; }
.conflict { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 6px; margin-left: .3rem; }
.conflict.busy { background: #fef3c7; color: #b45309; }
.conflict.unavailable { background: #fee2e2; color: #b91c1c; }
.conflict.tentative { background: #e0e7ff; color: #4338ca; }

/* ---- Calendar ------------------------------------------------------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.cal-nav { display: flex; align-items: center; gap: .6rem; }
.cal-title { font-size: 1.3rem; min-width: 190px; text-align: center; }
.calendar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7,1fr); background: #fafbfe; border-bottom: 1px solid var(--line); }
.cal-weekdays span { padding: .6rem; text-align: center; font-size: .74rem; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .4rem; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: #fafbfe; }
.cal-cell.other .cal-num { color: #cbd5e1; }
.cal-cell.today { background: color-mix(in srgb, var(--accent) 12%, #fff); }
.cal-cell.today .cal-num { background: var(--brand); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-num { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.cal-ev { display: flex; align-items: center; gap: 3px; width: 100%; text-align: left; border: 0; background: #eef2ff; color: var(--ink); border-radius: 6px;
  padding: .2rem .35rem; font-size: .72rem; margin-top: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-ev:hover { background: #e0e7ff; }
.cal-ev .lg-dot { margin: 0; flex: 0 0 auto; }
.cal-legend { display: flex; gap: 1.2rem; margin-top: 1rem; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }

/* ---- Crew member cards --------------------------------------------- */
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 1rem; }
.member-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.member-top { display: flex; align-items: center; gap: .8rem; }
.member-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.member-id { flex: 1; min-width: 0; }
.member-id strong { display: block; }
.member-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin: .8rem 0; }
.member-meta { display: flex; flex-direction: column; gap: .25rem; font-size: .84rem; color: var(--muted); margin-bottom: .9rem; }
.member-meta svg { vertical-align: -3px; margin-right: 4px; }
.member-actions { display: flex; gap: .4rem; align-items: center; }
.member-actions .btn { flex: 1; }

/* ---- Website tabs / services / messages ---------------------------- */
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1.4rem; }
.tab { border: 0; background: none; padding: .8rem 1.1rem; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.form-panel { max-width: 860px; }
.svc-admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow-sm); }
.svc-admin-card.inactive { opacity: .6; }
.svc-admin-card .svc-icon { width: 48px; height: 48px; }
.svc-admin-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.msg-list { display: grid; gap: 1rem; max-width: 820px; }
.msg-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow-sm); }
.msg-card.is-new { border-left: 4px solid var(--brand); }
.msg-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.msg-meta { display: flex; gap: .7rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: .7rem; align-items: center; }
.msg-body { color: var(--ink-soft); font-size: .92rem; margin-bottom: .9rem; }
.msg-actions { display: flex; gap: .4rem; }

/* ---- Auth (login) --------------------------------------------------- */
.auth-body { background: var(--brand-2); }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brandside { position: relative; overflow: hidden; color: #fff; padding: clamp(2rem,5vw,4rem); display: flex; align-items: center;
  background: linear-gradient(160deg,#0b1120,#161f36 60%,#0b1120); }
.auth-brandside::before { content:""; position:absolute; inset:0;
  background: radial-gradient(700px 400px at 20% 10%, color-mix(in srgb,var(--brand) 55%, transparent), transparent 60%); }
.auth-grid-bg { position: absolute; inset: 0; opacity: .4;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.05) 1px,transparent 1px);
  background-size: 42px 42px; }
.auth-brand-inner { position: relative; max-width: 460px; }
.auth-headline { font-size: clamp(1.8rem,3.5vw,3rem); margin: 1.8rem 0 1rem; color: #fff; }
.auth-tag { color: rgba(255,255,255,.75); font-size: 1.05rem; }
.auth-points { list-style: none; padding: 0; margin: 1.8rem 0 0; display: grid; gap: .7rem; }
.auth-points li { display: flex; align-items: center; gap: .6rem; color: rgba(255,255,255,.85); font-weight: 600; }
.auth-points svg { color: var(--accent); }
.auth-formside { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; padding: 2.2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 1.6rem; }
.auth-card > .muted { margin-bottom: 1.4rem; }
.auth-alt { text-align: center; margin-top: 1.1rem; }
.auth-alt a { color: var(--brand); font-weight: 600; font-size: .88rem; }
.auth-home { display: block; text-align: center; margin-top: 1.4rem; color: var(--muted); font-size: .85rem; }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 1000px){ .dash-grid { grid-template-columns: 1fr; } .crew-mgr-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px){ .auth-split { grid-template-columns: 1fr; } .auth-brandside { display: none; } }
@media (max-width: 820px){
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .app-main { margin-left: 0; }
  .menu-btn { display: block; }
  .sched-card { flex-wrap: wrap; }
  .sched-actions { flex-direction: row; width: 100%; }
}
