:root {
  --cyan: #0e7490;
  --cyan-bright: #06b6d4;
  --ink: #1e293b;
  --muted: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --danger: #b91c1c;
  --ok: #15803d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1.5rem;
}
.brand { font-size: 1.2rem; font-weight: 700; color: #fff; text-decoration: none; }
.brand span { color: var(--cyan-bright); }
.topbar nav { display: flex; gap: 1.2rem; flex: 1; }
.topbar nav a { color: #cbd5e1; text-decoration: none; padding: 0.3rem 0; }
.topbar nav a:hover { color: #fff; }
.userbox { display: flex; align-items: center; gap: 0.8rem; color: #cbd5e1; }
.userbox small { color: var(--cyan-bright); }

main { max-width: 1100px; margin: 1.5rem auto 3rem; padding: 0 1.5rem; }
footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem 0 2rem; }

h1 { font-size: 1.5rem; margin: 0.2rem 0 0.8rem; }
h1 small { color: var(--muted); font-weight: 400; font-size: 1.05rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }

.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.3rem; }
.crumbs a { color: var(--cyan); text-decoration: none; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 1.5rem 0; }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin: 0.8rem 0; }
th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: #f8fafc; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
tr:last-child td:first-child { border-bottom-left-radius: 8px; }
tr:last-child td:last-child { border-bottom-right-radius: 8px; }
td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
td form { display: inline; }
.actions a { margin-right: 0.7rem; }

a { color: var(--cyan); }
.docid { font-family: Consolas, monospace; font-weight: 600; letter-spacing: 0.02em; }
a.docid { text-decoration: none; }

.tag { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.tag.rev { background: #cffafe; color: var(--cyan); }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.off { background: #fee2e2; color: var(--danger); }
.tag.plain { background: var(--line); color: var(--muted); }
.tag.warn { background: #fef3c7; color: #92400e; }
a.tag { text-decoration: none; }
.small { font-size: 0.78rem; }

.btn {
  display: inline-block;
  background: var(--cyan);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--cyan-bright); }
.btn.ghost { background: transparent; color: var(--cyan); border: 1px solid var(--cyan); }
.btn.ghost:hover { background: #ecfeff; }
.linklike { background: none; border: none; color: var(--cyan); cursor: pointer; padding: 0; font-size: inherit; font-family: inherit; text-decoration: underline; }
.linklike.danger { color: var(--danger); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1.2rem 1.5rem; margin: 0.8rem 0; }
.card.narrow { max-width: 480px; margin: 2rem auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }

form p { margin: 0.7rem 0; }
form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
input[type=text], input[type=password], input[type=email], input[type=file], input[type=number], select, textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan-bright); border-color: transparent; }
.helptext { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.2rem; }
ul.errorlist { color: var(--danger); font-size: 0.85rem; margin: 0.2rem 0; padding-left: 1.1rem; }

.filters { display: flex; gap: 0.6rem; margin: 1rem 0; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 160px; }
.inline-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; }

.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; cursor: pointer; padding: 0.1rem 0.55rem; border-radius: 6px; font-weight: 700; color: var(--muted); user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--line); color: var(--ink); }
.menu-items { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 130px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12); padding: 0.3rem; }
.menu-items a, .menu-items button { display: block; width: 100%; text-align: left; padding: 0.4rem 0.7rem; border: none; background: none; border-radius: 6px; font-size: 0.88rem; font-family: inherit; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu-items a:hover, .menu-items button:hover { background: var(--bg); }
.menu-items button.danger { color: var(--danger); }
.menu-items form { display: block; }

.msg { padding: 0.6rem 1rem; border-radius: 6px; margin: 0.6rem 0; font-size: 0.9rem; }
.msg.success { background: #dcfce7; color: var(--ok); }
.msg.error { background: #fee2e2; color: var(--danger); }
.msg.info, .msg.warning { background: #fef9c3; color: #854d0e; }
