/* Ascent Kanban - application styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg:          #ffffff;
  --bg-sunk:     #f7f8f9;
  --line:        #e5e7eb;
  --line-strong: #d3d6db;
  --ink:         #1a1a1a;
  --ink-soft:    #5b6069;
  --ink-faint:   #8a8f98;
  --accent:      #1a1a1a;
  --danger:      #b42318;
  --danger-bg:   #fef3f2;
  --ok:          #067647;
  --ok-bg:       #ecfdf3;
  --radius:      6px;
  --shadow:      0 1px 2px rgba(16,24,40,.05);
}

* { box-sizing: border-box; }

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

/* Inter everywhere, including form controls, which otherwise
   fall back to the OS default. */
html, body, input, select, textarea, button, optgroup, option, label,
table, th, td, .btn {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  background: var(--bg-sunk);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); }

/* ---------------- Top bar (regular users) ---------------- */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.brand img { height: 36px; display: block; width: auto; }

/* ---------------- Sidebar (admins) ---------------- */
:root { --sidebar-w: 210px; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.sidebar-brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.sidenav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}
.navgroup {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  padding: 0 8px;
  margin: 14px 0 5px;
}
.navgroup:first-child { margin-top: 0; }

.sidenav a {
  display: block;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 7px 8px;
  border-radius: var(--radius);
  margin-bottom: 1px;
}
.sidenav a:hover { background: var(--bg-sunk); color: var(--ink); }
.sidenav a.on {
  background: var(--bg-sunk);
  color: var(--ink);
  font-weight: 500;
}

.sidefoot {
  border-top: 1px solid var(--line);
  padding: 12px 12px 14px;
}
.sidefoot-brand {
  display: block;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.sidefoot-brand img { height: 32px; display: inline-block; }

.whoami { margin-bottom: 9px; padding: 0 2px; }
.whoami-name { font-size: 13px; color: var(--ink); }
.whoami-mail {
  font-size: 11px; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Shell shifts to make room for the sidebar */
body.has-sidebar .shell { margin-left: var(--sidebar-w); }
body.has-sidebar .wrap  { max-width: 1120px; }

/* Mobile bar + off-canvas drawer */
.mobilebar { display: none; }
.nav-scrim { display: none; }

/* Kept in the layout (not display:none) so :checked still applies,
   and so it stays reachable by keyboard. */
.navtoggle {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.navtoggle:focus-visible + .mobilebar .burger { outline: 2px solid var(--ink); outline-offset: 2px; }

.burger {
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px; width: 34px; height: 34px; padding: 7px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  cursor: pointer; background: var(--bg); flex: 0 0 auto;
}
.burger span { display: block; height: 1.5px; background: var(--ink); border-radius: 2px; }

.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.nav a:hover { background: var(--bg-sunk); color: var(--ink); }
.nav a.on { background: var(--bg-sunk); color: var(--ink); font-weight: 500; }
.nav .who {
  font-size: 12px; color: var(--ink-faint);
  padding-left: 12px; margin-left: 6px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

/* ---------------- Layout ---------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 56px; }
.wrap-narrow { max-width: 620px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin: 0 0 18px; flex-wrap: wrap;
}
h1 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.sub { color: var(--ink-faint); font-size: 13px; margin: 3px 0 0; }

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card + .card { margin-top: 16px; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label {
  display: block; font-size: 12px; color: var(--ink-soft);
  margin: 0 0 5px; font-weight: 500;
}
label .req { color: var(--danger); }

input[type=text], input[type=email], input[type=date], input[type=number],
input[type=password], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  box-sizing: border-box;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; resize: vertical; min-height: 84px; padding: 8px 10px; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6069' d='M6 8.5 2 4.5h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26,26,26,.08);
}
input:disabled, select:disabled { background: var(--bg-sunk); color: var(--ink-faint); }

.hint { font-size: 12px; color: var(--ink-faint); margin: 5px 0 0; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }

/* ---------------- Buttons ---------------- */
/* Height is fixed rather than derived from padding, so an <a> and a
   <button> in the same row always match. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-sunk); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-danger { color: var(--danger); border-color: #f0c8c4; background: var(--bg); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Text-only button, for inline controls like "Select all". */
.linkbtn {
  background: none; border: 0; padding: 0;
  font-size: 12px; color: var(--ink-soft);
  cursor: pointer; text-decoration: underline;
}
.linkbtn:hover { color: var(--ink); }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------------- Alerts ---------------- */
.alert {
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-sunk);
  margin: 0 0 16px;
}
.alert-error { color: var(--danger); background: var(--danger-bg); border-color: #f6d4d0; }
.alert-ok    { color: var(--ok);     background: var(--ok-bg);     border-color: #c7ead8; }

/* ---------------- Tables ---------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

/* Fixed layout: columns obey <colgroup> widths and text wraps or
   ellipses instead of forcing the table wider than the page. */
table.data.table-fixed {
  table-layout: fixed;
  white-space: normal;
}
table.data.table-fixed th,
table.data.table-fixed td {
  overflow: hidden;
  text-overflow: ellipsis;
}

table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
  vertical-align: middle;
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.wrap-cell { white-space: normal; min-width: 220px; max-width: 380px; }
table.data td.num, table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
table.data tfoot td {
  border-top: 1px solid var(--line-strong);
  font-weight: 500;
  background: var(--bg-sunk);
}

/* Two-line cell: main value with a quieter detail underneath. */
.cell-strong {
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-main {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-sub {
  font-size: 11.5px; color: var(--ink-faint); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.muted { color: var(--ink-faint); }
.is-over { color: var(--danger); }
.row-muted td { opacity: .6; }

/* Actions column: buttons share one baseline and one height, and must never
   be clipped by the fixed-table overflow rule. */
th.col-actions, td.col-actions {
  text-align: right;
  overflow: visible;
  white-space: nowrap;
}
.rowactions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: stretch;
  flex-wrap: nowrap;
}
.rowactions form { margin: 0; display: flex; }
.rowactions .btn { height: 28px; padding: 0 10px; line-height: 1; flex: 0 0 auto; }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-faint); font-size: 13px; }

.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border: 1px solid var(--line-strong); border-radius: 100px; color: var(--ink-soft);
}
.pill-on {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: #c7ead8;
}
.pill-off {
  color: var(--ink-faint);
  background: var(--bg-sunk);
  border-color: var(--line);
}
.pill-renew {
  color: #5a3ea8;
  background: #f4f1fc;
  border-color: #ddd3f5;
  font-size: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Auto-renew block inside the project modal. */
.renew-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunk);
  padding: 12px 14px;
}
.renew-block.has-error { border-color: var(--danger); }
.renew-detail { padding-left: 24px; }
.renew-detail label { margin-bottom: 4px; }
.renew-detail input { max-width: 220px; }

/* Tabular figures from Inter itself, so numeric columns line up
   without switching to a monospace face. */
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---------------- User picker (project assignment) ---------------- */
.picker {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.picker-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
}
.picker-search { height: 30px; font-size: 13px; flex: 1; }
.picker-bulk { display: flex; gap: 10px; flex: 0 0 auto; }

.picker-list { max-height: 210px; overflow-y: auto; padding: 4px; }
.picker-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius);
  font-size: 13px; font-weight: 400; color: var(--ink);
  margin: 0; cursor: pointer;
}
.picker-item:hover { background: var(--bg-sunk); }
.picker-item input { width: auto; height: auto; margin: 0; flex: 0 0 auto; }
.picker-name { flex: 0 0 auto; }
.picker-mail {
  color: var(--ink-faint); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 auto; min-width: 0;
}

/* ---------------- Drag to reorder ---------------- */
.draghandle {
  cursor: grab;
  color: var(--line-strong);
  text-align: center;
  user-select: none;
}
.draghandle:active { cursor: grabbing; }
tr[draggable="true"]:hover .draghandle { color: var(--ink-faint); }
tr.dragging {
  opacity: .45;
  background: var(--bg-sunk) !important;
}

/* ---------------- Password field ---------------- */
.pw-wrap { position: relative; }
.pw-wrap input {
  padding-right: 62px;
  letter-spacing: .06em;
}
.pw-wrap input:placeholder-shown { letter-spacing: normal; }
.pw-toggle {
  position: absolute;
  top: 50%; right: 6px;
  transform: translateY(-50%);
  height: 24px; padding: 0 8px;
  display: inline-flex; align-items: center;
  background: none; border: 0;
  font-size: 11.5px; font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 4px;
}
.pw-toggle:hover { background: var(--bg-sunk); color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.pw-meter {
  display: flex; gap: 4px; margin-top: 7px;
}
.pw-meter span {
  height: 3px; flex: 1;
  background: var(--line);
  border-radius: 2px;
  transition: background .15s;
}
.pw-meter.s1 span:nth-child(1) { background: var(--danger); }
.pw-meter.s2 span:nth-child(-n+2) { background: #d98a00; }
.pw-meter.s3 span:nth-child(-n+3) { background: #b8a300; }
.pw-meter.s4 span { background: var(--ok); }

.pw-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 6px; min-height: 15px; }
.pw-caps { color: #b45309; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- Field errors ---------------- */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.field.has-error input:focus,
.field.has-error select:focus {
  box-shadow: 0 0 0 3px rgba(180,35,24,.10);
}
.field-error {
  font-size: 12px;
  color: var(--danger);
  margin: 5px 0 0;
}

/* A date computed from the validity period, not typed by hand. */
input.is-derived {
  background: var(--bg-sunk);
  color: var(--ink-soft);
}

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 60;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg);
  border-radius: 8px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 12px 48px rgba(16,24,40,.24);
  margin: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-x {
  background: none;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}
.modal-x:hover { color: var(--ink); background: var(--bg-sunk); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 620px) {
  .modal-overlay { padding: 0; }
  .modal { max-width: none; min-height: 100%; border-radius: 0; }
}

/* ---------------- Filters ---------------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.filters .field { margin: 0; flex: 1 1 150px; min-width: 130px; }
.filters .field label { font-size: 11px; }
.filters input, .filters select { padding: 6px 9px; font-size: 13px; }
.filters .filter-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.count { font-size: 12px; color: var(--ink-faint); }

/* ---------------- Stats ---------------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; flex: 1 1 150px; box-shadow: var(--shadow);
}
.stat .k { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------------- Auth ---------------- */
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 18px;
}
.auth-card { width: 100%; max-width: 380px; }
/* Logo sits inside the card, left-aligned above the heading. */
.auth-brand { margin: 0 0 22px; }
.auth-brand img { height: 46px; width: auto; display: block; }

.auth-card .card-pad { padding: 28px; }
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; }
.auth-card .sub { margin-top: 5px; }
.otp-input {
  text-align: center; letter-spacing: 9px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-size: 22px; padding: 12px 10px;
}

/* ---------------- Footer ---------------- */
.foot {
  text-align: center; padding: 28px 20px 34px;
  color: var(--ink-faint); font-size: 12px;
}
.foot .pb { margin: 0 0 8px; }
.foot img { height: 32px; display: inline-block; }

/* ---------------- Pagination ---------------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; flex-wrap: wrap; }
.pager a, .pager span {
  font-size: 12px; padding: 5px 9px; border-radius: var(--radius);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft);
}
.pager .now { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .off { opacity: .4; pointer-events: none; }

/* ---------------- Mobile ---------------- */
@media (max-width: 900px) {
  /* Sidebar becomes an off-canvas drawer behind a burger button. */
  body.has-sidebar .shell { margin-left: 0; }

  .mobilebar {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 9px 14px; position: sticky; top: 0; z-index: 45;
  }
  .mobilebar .brand img { height: 32px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    width: 250px;
  }
  .navtoggle:checked ~ .sidebar {
    transform: translateX(0);
    box-shadow: 0 10px 40px rgba(16,24,40,.18);
  }
  .navtoggle:checked ~ .nav-scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(16,24,40,.35); z-index: 48;
  }
  .sidebar-brand { padding: 16px 18px; }
}

@media (max-width: 720px) {
  .topbar-in { min-height: 56px; padding: 8px 14px; gap: 10px; }
  .brand img { height: 32px; }
  .nav { width: 100%; margin-left: 0; gap: 0; overflow-x: auto; }
  .nav a { padding: 6px 8px; font-size: 12.5px; }
  .nav .who { display: none; }
  .wrap { padding: 16px 14px 44px; }
  h1 { font-size: 17px; }
  .card-pad { padding: 16px; }
  .filters { padding: 12px; }
  .filters .field { flex: 1 1 100%; }
  .filters .filter-actions { width: 100%; }
  .filters .filter-actions .btn { flex: 1; }
  .stat { flex: 1 1 100%; }
  .row > * { flex: 1 1 100%; }
  .actions .btn { flex: 1; }
}

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

@media print {
  .topbar, .sidebar, .mobilebar, .nav-scrim,
  .filters, .toolbar, .pager, .foot, .actions { display: none !important; }
  body { background: #fff; }
  body.has-sidebar .shell { margin-left: 0; }
  .card { border: 0; box-shadow: none; }
}
