:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e8f0ff, transparent 34rem), var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

a { color: var(--accent); }
a.btn { text-decoration: none; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #0f172a;
  color: #f8fafc;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  font-weight: 800;
}

.brand-title { font-weight: 800; font-size: 18px; }
.brand-subtitle { color: #94a3b8; font-size: 13px; margin-top: 2px; }

.nav-button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 12px 14px;
  border-radius: 14px;
  margin: 4px 0;
}

.nav-button:hover, .nav-button.active {
  background: rgba(148, 163, 184, 0.16);
  color: #fff;
}

.main {
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

h1 { margin: 0; font-size: 30px; }
h2 { margin: 0 0 16px; font-size: 20px; }
h3 { margin: 0 0 12px; }
p { color: var(--muted); line-height: 1.55; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 750;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--danger); }

.table-wrap { overflow: auto; }

.table-input,
.table-select {
  width: 100%;
  min-width: 130px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.table-input.small-field,
.table-select.small-field {
  min-width: 110px;
}


table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e0ecff;
  color: #1d4ed8;
}

.badge.green { background: #dcfce7; color: #15803d; }
.badge.gray { background: #e2e8f0; color: #475569; }
.badge.red { background: #fee2e2; color: #b91c1c; }

.notice {
  padding: 12px 14px;
  border-radius: 16px;
  margin: 12px 0;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.notice.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 20px;
  color: var(--muted);
  background: #f8fafc;
}

.muted { color: var(--muted); }
.subscription-note {
  white-space: pre-wrap;
  line-height: 1.55;
  margin: 8px 0 14px;
}
.small { font-size: 13px; }
.stack { display: grid; gap: 18px; }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .main { padding: 18px; }
  .grid.two, .grid.three, .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

.full-span { grid-column: 1 / -1; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.compact-label {
  min-width: 240px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.resource-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #f8fafc;
  display: grid;
  gap: 12px;
}

.resource-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.resource-card h3 {
  margin: 0;
}

.resource-description {
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.resource-description a {
  color: var(--accent);
  font-weight: 750;
}

.resource-period {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.resource-period span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.resource-period strong {
  font-size: 20px;
  line-height: 1.2;
}

.news-list {
  display: grid;
  gap: 14px;
}

.news-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #f8fafc;
}

.news-card h3 {
  margin: 4px 0 8px;
}

.news-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.news-body {
  color: var(--text);
  line-height: 1.55;
}

.news-body a {
  overflow-wrap: anywhere;
}

button:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 860px) {
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .compact-label {
    min-width: 0;
  }
  .full-span {
    grid-column: auto;
  }
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: auto;
}

.resource-created {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.resource-expire {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.resource-expire span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.resource-expire strong {
  font-size: 18px;
  line-height: 1.15;
}

.table-textarea {
  min-width: 220px;
  min-height: 64px;
  resize: vertical;
  font-size: 13px;
}

.small-btn {
  padding: 8px 10px;
  font-size: 12px;
  margin-top: 8px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 750;
  padding: 4px 0;
  justify-self: start;
}

.link-button:hover {
  color: var(--accent-dark);
}

.resource-meta-line {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding-top: 2px;
}

.resource-deadline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.resource-deadline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.resource-deadline strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
}

.resource-deadline.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.resource-deadline.red {
  border-color: #fecaca;
  background: #fef2f2;
}

.resource-deadline.gray {
  border-color: #e2e8f0;
  background: #f8fafc;
}

@media (max-width: 860px) {
  body {
    background: var(--bg);
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  }

  .sidebar .brand {
    margin-bottom: 10px;
  }

  .sidebar .brand-subtitle {
    display: none;
  }

  .sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: center;
    margin: 0;
    padding: 10px 12px;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    flex-direction: row;
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar .muted {
    font-size: 13px;
  }

  .card {
    border-radius: 20px;
    padding: 18px;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .resource-deadline {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .resource-deadline strong {
    white-space: normal;
  }
}

.resource-qr-wrap {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.resource-qr {
  width: min(220px, 100%);
  max-height: 260px;
  object-fit: contain;
  border-radius: 12px;
}

.resource-download {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.resource-download:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.attachment-stack {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.attachment-admin-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.attachment-admin-line span {
  overflow-wrap: anywhere;
}

.file-picker {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.file-picker:hover {
  background: #cbd5e1;
}

.file-picker input {
  display: none;
}

.sort-header {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: 850;
  text-transform: inherit;
  letter-spacing: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.sort-header:hover,
.sort-header.active {
  color: var(--accent);
}
