/* Mah-Sen Portal — same palette as mah-sen.com */
:root {
  --bg: #0B0B0C; --bg-2: #111113; --surface: #141416; --surface-2: #19191C;
  --line: #222326; --line-2: #2C2D31; --line-3: #3A3B3F;
  --ink: #F2F2F2; --ink-2: #C9CBCE; --muted: #A3A6AA; --silver: #8C9094;
  --red: #E3262E; --red-ink: #FF4D52; --red-btn: #C81E25; --red-btn-hover: #A9181E;
  --ok: #3DBE76; --ok-ink: #7FD3A0; --ok-bg: #173826;
  --doing: #E3A33A; --doing-ink: #F0C36B; --doing-bg: #3A2C10;
  --wait-ink: #FF8A8E; --wait-bg: #3B1416;
  --display: "Unbounded", "Arial Black", sans-serif;
  --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(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
a:hover { color: var(--red-ink); }
:focus-visible { outline: 2px solid var(--red-ink); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11,11,12,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: flex-end; gap: 9px; color: #E6E6E6; text-decoration: none; }
.brand span { font-family: var(--display); font-weight: 500; font-size: 15px; letter-spacing: .3em; line-height: 1; }
.brand small { font-family: var(--body); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--red-ink); font-weight: 600; margin-left: 4px; }
.top nav { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--ink-2); }
.who { font-size: 13px; color: var(--muted); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-3); background: transparent; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--silver); color: var(--ink); }
.btn-red { background: var(--red-btn); border-color: var(--red-btn); color: #fff; }
.btn-red:hover { background: var(--red-btn-hover); border-color: var(--red-btn-hover); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { min-width: 32px; padding: 0; }
.btn-danger:hover { border-color: var(--red); color: var(--red-ink); }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea { width: 100%; min-height: 42px; border-radius: 9px; border: 1px solid var(--line-3); background: var(--bg); color: var(--ink); padding: 0 12px; font: inherit; font-size: 14px; }
textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--red-btn); }
.grid-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid-form .full { grid-column: 1 / -1; }
.flash { margin: 16px 0; padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid #23573A; }
.flash-err { background: var(--wait-bg); color: var(--wait-ink); border: 1px solid #5C2124; }
.flash ul { margin: 0; padding-left: 18px; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background-color: var(--bg); background-image: linear-gradient(180deg, rgba(11,11,12,.6), rgba(11,11,12,.92)), url(/img/tugla.jpg); background-size: cover; background-position: center; }
.auth-card { width: 100%; max-width: 420px; background: rgba(18,18,20,.94); border: 1px solid var(--line-2); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-family: var(--display); font-size: 24px; font-weight: 700; }
.glow { height: 2px; width: 140px; background: linear-gradient(90deg, rgba(227,38,46,0), #FF2A30 40%, rgba(227,38,46,0)); box-shadow: 0 0 14px 2px rgba(255,42,48,.5); }

/* page */
main { padding: 32px 0 80px; }
.page-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--red-ink); font-weight: 600; margin-bottom: 8px; }
.page-title h1 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.15; }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
section.block { margin-top: 36px; scroll-margin-top: 90px; }
section.block > h2 { font-family: var(--display); font-size: 20px; font-weight: 500; margin-bottom: 4px; }
section.block > .sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* progress */
.overall { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.big-pct { font-family: var(--display); font-size: 44px; font-weight: 700; line-height: 1; }
.bar { height: 10px; border-radius: 10px; background: var(--line-2); overflow: hidden; display: flex; }
.bar .done { background: var(--red); }
.bar .doing { background: var(--doing); opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend b { color: var(--ink); }
.phase-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.phase-card .name { font-family: var(--display); font-size: 16px; font-weight: 500; }
.phase-card .pct { font-family: var(--display); font-size: 26px; }
.phase-card .bar { height: 6px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-3); background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }

/* modules */
.modules { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.module { display: flex; flex-direction: column; gap: 12px; }
.module[hidden] { display: none; }
.module-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.module-head .code { font-size: 12px; font-weight: 600; color: var(--red-ink); letter-spacing: .06em; }
.module-head h3 { font-size: 16px; font-weight: 600; margin-top: 2px; }
.module-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ring { width: 54px; height: 54px; position: relative; flex: none; }
.ring svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--line-2); }
.ring .val { stroke: var(--red); stroke-linecap: round; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.item { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 9px 10px; border-radius: 10px; }
.item:hover { background: var(--surface-2); }
.item[hidden] { display: none; }
.st { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #4A4B4F; margin-top: 2px; display: inline-flex; align-items: center; justify-content: center; }
.st-done { background: #2E7D4F; border-color: #2E7D4F; }
.st-doing { border-color: var(--doing); background: radial-gradient(circle, var(--doing) 0 3px, transparent 4px); }
.item .txt { font-size: 14px; color: var(--ink); }
.item.is-done .txt { color: var(--ink-2); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: 12px; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-3); color: var(--ink-2); font-size: 12px; }
.tag-firma { border-color: #5C2124; color: var(--wait-ink); background: var(--wait-bg); }
.tag-done { border-color: #23573A; color: var(--ok-ink); background: var(--ok-bg); }
.tag-doing { border-color: #5A4317; color: var(--doing-ink); background: var(--doing-bg); }
.note-pub { margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--silver); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13px; color: var(--ink-2); white-space: pre-line; }
.note-int { margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--doing); background: #1E1A10; border-radius: 0 8px 8px 0; font-size: 13px; color: var(--doing-ink); white-space: pre-line; }

/* decisions */
.decision { border: 1px solid var(--line-2); border-radius: 14px; padding: 16px; background: var(--surface); scroll-margin-top: 90px; }
.decision + .decision { margin-top: 10px; }
.comments { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.comment { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.comment .by { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment p { white-space: pre-line; }
.comment.staff { border-left: 2px solid var(--red); }
.comment-form { margin-top: 10px; display: grid; gap: 8px; }
.comment-form textarea { min-height: 64px; }
.delivered ul { list-style: none; margin: 0; padding: 0; }
.delivered li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* admin */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl { overflow-x: auto; }
details.edit > summary { cursor: pointer; list-style: none; display: inline-flex; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > .panel { margin-top: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); }
.phase-admin { border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; background: var(--bg-2); }
.phase-admin + .phase-admin { margin-top: 16px; }
.phase-admin > header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.phase-admin > header h2 { font-family: var(--display); font-size: 18px; font-weight: 500; }
.kind { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-3); border-radius: 999px; padding: 2px 8px; }
.module-admin { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; background: var(--surface); margin-top: 10px; }
.module-admin > header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.item-admin { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.item-admin .tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; justify-content: flex-end; }
.item-admin select { min-height: 32px; width: auto; font-size: 13px; padding: 0 8px; }
.history { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.inline { display: inline; }
:target { animation: hl 1.6s ease-out; }
@keyframes hl { from { background: rgba(227,38,46,.18); } to { background: transparent; } }

@media (max-width: 640px) {
  .overall { grid-template-columns: 1fr; }
  .card, .auth-card { padding: 18px; }
  .item-admin { grid-template-columns: 1fr; }
  .item-admin .tools { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { :target { animation: none; } }
