@font-face {
  font-family: Cairo;
  src: url("/Cairo.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ground: #f4f6f3;
  --paper: #fff;
  --ink: #18362e;
  --muted: #546b62;
  --brand: #31695c;
  --line: #d7e2dc;
  --tint: #e8f2ed;
  --gold: #d79c38;
  --error: #98332d;
  --error-bg: #fff0ef;
  --note: #74501c;
  --note-bg: #fbf3de;
}
html.dark {
  color-scheme: dark;
  --ground: #17221e;
  --paper: #20352c;
  --ink: #eaf4ee;
  --muted: #b7ccc0;
  --brand: #76b5a0;
  --line: #3a5547;
  --tint: #294a3e;
  --error: #ffb3ad;
  --error-bg: #482927;
  --note: #f0ce8a;
  --note-bg: #393325;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 400 15px/1.65 Cairo, Tahoma, sans-serif;
  background: var(--ground);
  color: var(--ink);
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 8px; }
button { cursor: pointer; font-weight: 700; padding: 8px 15px; color: var(--ink); background: var(--paper); }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #ca9238; outline-offset: 2px; }
button:hover:not(:disabled) { filter: brightness(.95); }
input:not([type="checkbox"]), select, textarea {
  width: 100%; min-width: 0; padding: 9px 12px; background: var(--paper); color: var(--ink);
}
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 4px; font-weight: 650; }
label.check { display: flex; align-items: center; gap: 8px; }
small, .help { color: var(--muted); }
form > small { margin-top: -10px; }
.primary { background: #31695c; border-color: #31695c; color: #fff; }
.secondary { background: var(--tint); color: var(--ink); border-color: var(--line); }
.quiet { background: transparent; border-color: transparent; }
.danger { color: var(--error); background: var(--error-bg); }
.wide { width: 100%; }
.error, .notice { padding: 10px 14px; border-radius: 8px; overflow-wrap: anywhere; }
.error { color: var(--error); background: var(--error-bg); }
.notice { color: var(--note); background: var(--note-bg); }
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; padding: 30px 16px;
  background: radial-gradient(ellipse at 100% 0, #31695c20, transparent 64%), var(--ground);
}
.auth-card { width: min(440px, calc(100vw - 32px)); padding: clamp(20px,5vw,40px); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 16px; background: var(--paper); box-shadow: 0 12px 40px #1c3c3010; }
.auth-brand, .brand { display: flex; align-items: center; gap: 12px; }
.brand b, .auth-brand b { font-size: 22px; font-weight: 800; }
.brand img, .auth-brand img { width: 46px; height: 46px; object-fit: contain; border-radius: 9px; background: #fff; }
.auth h1 { margin: 24px 0 0; font-size: 25px; }
.auth .help { margin: 2px 0 20px; }
.downloads { scroll-margin-top: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.downloads h2 { margin: 0 0 12px; font-size: 18px; }
.download-list { display: grid; gap: 8px; }
.download-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.download-card > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.download-card small { font-size: 12px; }
.download-link, .downloads-shortcut { display: inline-flex; align-items: center; justify-content: center; padding: 6px 15px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.download-link { min-height: 38px; background: #31695c; color: #fff; }
.downloads-shortcut { border: 1px solid var(--line); }
.download-link:focus-visible, .downloads-shortcut:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.download-link:hover, .downloads-shortcut:hover { filter: brightness(.94); }
#downloads-status { margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
#dashboard-downloads .download-list { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
form { display: grid; gap: 14px; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0,1fr); }
aside { background: #1c473c; color: white; padding: 25px 18px; display: flex; flex-direction: column; gap: 30px; height: 100vh; position: sticky; top: 0; }
.brand { padding: 0 8px; }
nav { display: grid; gap: 5px; }
nav button { text-align: start; padding: 11px 16px; border: 0; border-inline-start: 3px solid transparent; color: #e0eee7; background: transparent; }
nav button[aria-current="page"] { background: #315e51; color: white; border-inline-start-color: #d79c38; }
.sidebar-foot { margin-top: auto; color: #c1d8cc; padding: 16px 10px 0; border-top: 1px solid #628074; }
.layout main { min-width: 0; }
header { background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px,4vw,54px); gap: 14px; }
.identity, .account-tools, .actions, .tools { display: flex; align-items: center; gap: 8px; }
.identity { gap: 10px; min-width: 0; }
.identity strong, .identity small { display: block; }
.avatar { flex: 0 0 36px; height: 36px; display: grid; place-content: center; color: var(--brand); border-radius: 50%; background: var(--tint); font-weight: 800; }
.account-tools { flex-wrap: wrap; }
.workspace { max-width: 1350px; margin: 0 auto; padding: 28px clamp(16px,4vw,54px) 60px; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(23px,3vw,33px); }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.title-row :is(h1,p), .profile :is(h3,p) { margin: 0; }
.title-row .help { font-size: 14px; }
.panel, .profile, .search-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.tools { flex-wrap: wrap; }
.search-wrap { padding: 12px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-wrap input { max-width: 440px; }
.search-wrap select { max-width: 180px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill,minmax(min(245px,100%),1fr)); }
.profile { padding: 17px; display: grid; gap: 11px; align-content: start; }
.profile-top,.profile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.badge { border-radius: 5px; padding: 2px 8px; background: var(--tint); color: var(--brand); font-size: 12px; font-weight: 750; }
.profile-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.profile-foot button { font-size: 13px; padding: 4px 10px; }
.endpoint { font-family: ui-monospace, monospace; font-size: 13px; overflow-wrap: anywhere; }
.empty { padding: 38px 15px; text-align: center; background: var(--paper); border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); grid-column: 1/-1; }
.panel { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: start; white-space: nowrap; font-size: 14px; }
td, th { text-align: start; padding: 12px 15px; border-bottom: 1px solid var(--line); }
th { background: var(--tint); }
tr:last-child td { border-bottom: 0; }
dialog { width: min(620px, calc(100vw - 24px)); max-height: 88vh; overflow: auto; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
dialog::backdrop { background: #0e211aaa; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialog-head h2,.dialog-head button { margin: 0; }
.dialog-head button { line-height: 1; font-size: 25px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.actions { flex-wrap: wrap; }
.grant { padding: 14px; background: var(--ground); border-radius: 8px; border: 1px solid var(--line); }
.grant .fields { margin-top: 10px; display: grid; gap: 12px; }
.grant .check { flex-wrap: wrap; }
.group-row { display: flex; gap: 8px; margin-bottom: 8px; }
.group-members { padding-inline-start: 24px; margin: 3px 0; color: var(--muted); }
#toast { position: fixed; bottom: 15px; inset-inline-end: 15px; max-width: calc(100vw - 30px); padding: 11px 16px; background: #1c473c; color: white; border-radius: 9px; box-shadow: 0 5px 18px #20372930; }
@media (max-width:800px) {
  .layout { grid-template-columns: 1fr; }
  aside { position: static; height: auto; padding: 12px; gap: 10px; }
  .brand img { width: 34px; height: 34px; }
  .brand b { font-size: 18px; }
  nav { display: flex; overflow: auto; }
  nav button { white-space: nowrap; padding: 7px 12px; }
  .sidebar-foot { display: none; }
  header { padding: 10px 14px; }
}
@media (max-width:510px) {
  .workspace { padding-top: 18px; }
  header { display: grid; }
  .account-tools { gap: 3px; }
  .account-tools button { padding: 5px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-wrap { display: grid; }
  .search-wrap select { max-width: none; }
}
