:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1e2836;
  --muted: #5c6673;
  --brand: #24425f;
  --brand-dark: #18314a;
  --brand-soft: #e8eef4;
  --accent: #c8a24b;
  --accent-dark: #a98634;
  --line: #e2ded4;
  --ok: #2e7d4f;
  --ok-soft: #e3f1e8;
  --warn: #9a6200;
  --warn-soft: #f7ecd8;
  --err: #a33a3a;
  --err-soft: #f6e4e4;
  --info: #2f6390;
  --info-soft: #e4eef6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 40, 54, .06), 0 4px 14px rgba(30, 40, 54, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.main { min-height: 62vh; padding-top: 28px; padding-bottom: 56px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* prototype banner */
.proto-band {
  background: #2b2b26; color: #e8e4d8; text-align: center;
  font-size: .78rem; padding: 5px 12px; letter-spacing: .02em;
}

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark { width: 40px; height: 40px; flex: none; }
.wordmark-text { font-weight: 700; font-size: 1.02rem; line-height: 1.15; display: flex; flex-direction: column; }
.wordmark-text small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-link { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; }
.nav-link:hover { background: var(--brand-soft); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-dark); }
.inline-form { display: inline; }
.lang-switch { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--line); }
.lang-link { padding: 4px 6px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .82rem; letter-spacing: .02em; }
.lang-link:hover { background: var(--brand-soft); color: var(--brand-dark); }
.lang-link.active { color: var(--brand-dark); }
.lang-sep { color: var(--line); font-size: .8rem; }

/* buttons */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  padding: 10px 18px; transition: background .12s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #241d0d; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-icon { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 1rem; cursor: pointer; color: var(--accent-dark); }
.btn-icon.fav-on { background: var(--accent); border-color: var(--accent); color: #241d0d; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* hero */
.hero { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%); border-radius: 14px; color: #fff; padding: 52px 44px; }
.hero-kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--accent); font-weight: 700; margin: 0 0 10px; }
.hero h1 { color: #fff; font-size: 2.1rem; max-width: 21em; }
.hero .lead { color: #d9e2ec; max-width: 46em; font-size: 1.04rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }
.hero-hint { color: #b9c7d6; font-size: .86rem; margin-top: 16px; }

/* sections & tiles */
.section { margin-top: 40px; }
.section-title { margin-top: 2rem; }
.section-sub, .page-sub { color: var(--muted); margin-top: -2px; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 6px 20px rgba(30, 40, 54, .12); }
.tile-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); margin-bottom: 2px; }
.tile-icon .sec-ico { width: 26px; height: 26px; }
.sec-ico { width: 1.3em; height: 1.3em; color: var(--brand); vertical-align: -0.15em; }
.title-with-ico { display: flex; align-items: center; gap: 10px; }
.sec-ico-lg { width: 30px; height: 30px; flex: none; }
.sec-ico-sm { width: 18px; height: 18px; vertical-align: -0.2em; }
.tile-name { font-weight: 700; }
.tile-count { color: var(--muted); font-size: .85rem; }
.tile-sm { padding: 16px; }

/* CTA band */
.cta-band {
  margin-top: 44px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.cta-band h2 { margin: 0 0 4px; }
.cta-band p { margin: 0; color: var(--muted); }

/* UWA search tool band */
.tool-band { border-left-color: var(--brand); margin-top: 28px; }
.band-badge { margin: 0 0 8px; }
.tool-callout { margin-top: 4px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* forms */
.narrow { max-width: 560px; margin: 0 auto; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .93rem; }
.form .hint { font-weight: 400; color: var(--muted); }
.form input, .form select, .form textarea, .filter-bar input, .filter-bar select, .inline-add input, .reject-form input, .structure-row input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.check { flex-direction: row !important; align-items: flex-start; gap: 9px !important; font-weight: 500 !important; }
.check input { width: auto !important; margin-top: 3px; }
.form-links { margin-top: 14px; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-err { background: var(--err-soft); color: var(--err); }

/* auth */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 860px; margin: 0 auto; align-items: start; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-side { padding: 28px 8px; }
.auth-side h2 { margin-top: 0; }
.status-panel, .success-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; text-align: center; box-shadow: var(--shadow); margin-top: 24px; }
.status-panel .badge { margin-bottom: 10px; }
.demo-box { margin-top: 20px; border: 1px dashed var(--accent-dark); background: #fdf9ef; border-radius: 8px; padding: 16px; text-align: left; }
.demo-box-title { font-weight: 700; color: var(--accent-dark); margin: 0 0 6px; text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; }

/* badges & tags */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .74rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); }
.badge-section { background: var(--brand-soft); color: var(--brand-dark); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #ececec; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .8rem; text-decoration: none; }
.tag:hover { border-color: var(--brand); color: var(--brand); }
.tag-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.tag-admin button { border: none; background: none; cursor: pointer; color: var(--err); font-size: .95rem; padding: 0 2px; }
.pill { background: var(--accent); color: #241d0d; border-radius: 20px; padding: 0 7px; font-size: .74rem; font-weight: 700; }

/* filter bar */
.filter-bar { display: flex; gap: 10px; margin: 20px 0 8px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type="search"] { flex: 2 1 220px; }
.filter-bar select { flex: 1 1 150px; width: auto; }
.filter-bar .btn { flex: none; }

/* cards */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-lang { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.card-title { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--brand); text-decoration: underline; }
.card-desc { margin: 0; color: var(--muted); font-size: .89rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8rem; margin-top: auto; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.reject-note { background: var(--err-soft); color: var(--err); border-radius: 8px; padding: 8px 12px; font-size: .85rem; margin: 0; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }

/* breadcrumbs & material */
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); }
.material-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.meta-item { color: var(--muted); font-size: .88rem; }
.material-desc { max-width: 52em; }
.material-actions { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; align-items: center; }
.pdf-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #4a4a4a; }
.pdf-frame .empty { margin: 20px; }

/* dropzone */
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 18px; text-align: center; background: var(--surface); transition: border-color .12s; }
.dropzone.dragover { border-color: var(--accent-dark); background: #fdf9ef; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-label { margin: 0; color: var(--muted); }
.dropzone-file { margin: 6px 0 0; font-weight: 600; color: var(--ok); }

/* cabinet & admin */
.cabinet { display: grid; grid-template-columns: 240px 1fr; gap: 26px; align-items: start; }
.cab-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.cab-user { padding: 6px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.cab-name { font-weight: 700; margin: 0; }
.cab-email { color: var(--muted); font-size: .82rem; margin: 2px 0 0; word-break: break-all; }
.cab-link { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; background: none; border: none; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.cab-link:hover { background: var(--brand-soft); }
.cab-link.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.cab-bottom { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.cab-danger-link { color: var(--err); }
.cab-delete summary::-webkit-details-marker { display: none; }
.cab-delete-form { padding: 8px 10px; display: flex; flex-direction: column; gap: 10px; font-size: .85rem; }
.cab-content { min-width: 0; }

/* admin bits */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-value { font-size: 1.9rem; font-weight: 800; margin: 0; color: var(--brand-dark); }
.stat-label { margin: 2px 0 0; font-weight: 600; }
.stat-sub { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.todo-list { padding-left: 20px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: var(--brand-soft); color: var(--brand-dark); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.td-actions { white-space: nowrap; }
.td-actions .inline-form { margin-right: 6px; }
.mod-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; box-shadow: var(--shadow); }
.mod-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mod-head h3 { margin: 0; }
.mod-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.reject-form { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.reject-form input { flex: 1; }
.msg-read { opacity: .65; }
.plain-list { list-style: none; padding: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.structure-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.structure-name { flex: 0 0 240px; font-weight: 600; }
.inline-add { display: flex; gap: 10px; margin-top: 10px; max-width: 420px; }

/* prose & misc */
.prose { max-width: 720px; }
.prose h1 { margin-bottom: 14px; }
.callout { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 14px 18px; margin: 20px 0; }
.draft-banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 16px; font-weight: 600; margin-bottom: 18px; font-size: .9rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-row { padding: 26px 20px; display: flex; flex-direction: column; gap: 8px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--ink); font-weight: 600; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-note { color: var(--muted); font-size: .82rem; margin: 0; max-width: 60em; }
.footer-credits { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; padding: 10px 0 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.credits-item { display: inline-flex; align-items: center; gap: 12px; }
.credits-label { color: var(--muted); font-size: .82rem; }
.credits-name { font-weight: 800; font-size: 1.02rem; letter-spacing: .01em; }
.logo-t4p { height: 46px; width: auto; }
.logo-uwa { height: 38px; width: auto; }
@media (max-width: 580px) {
  .footer-credits { gap: 14px; }
  .logo-t4p { height: 38px; }
  .logo-uwa { height: 32px; }
}

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }

/* responsive */
@media (max-width: 900px) {
  .tile-grid, .card-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-grid { grid-template-columns: 1fr; }
  .cabinet { grid-template-columns: 1fr; }
  .cab-nav { position: static; }
}
@media (max-width: 580px) {
  .tile-grid, .card-grid, .card-grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 34px 22px; }
  .hero h1 { font-size: 1.55rem; }
  h1 { font-size: 1.5rem; }
  .header-row { justify-content: center; }
  .structure-row { flex-wrap: wrap; }
  .structure-name { flex-basis: 100%; }
}
