:root {
  --blue: #015896;
  --blue-hover: #014b80;
  --blue-active: #013f6c;
  --blue-soft: #eef6fb;
  --blue-border: #d5e8f4;
  --yellow: #fbc422;
  --page: #f6f8fb;
  --surface: #ffffff;
  --hover: #f3f5f8;
  --head: #fbfcfd;
  --text: #1d2939;
  --text-2: #475467;
  --muted: #667085;
  --faint: #98a2b3;
  --border: #e7ebf0;
  --radio: #d0d5dd;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --overlay: rgba(16, 20, 25, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

button, input { font-family: inherit; }

a { color: var(--blue); }
a:hover { color: var(--blue-hover); }

.hidden { display: none !important; }

/* Login / 404 */
.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 340px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  margin: 0 auto;
}

.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 14px;
}

.login-card p {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 8px;
  margin-bottom: 32px;
}

.login-foot {
  margin-top: 36px;
  font-size: 12px;
  color: var(--muted);
}

.denied {
  font-size: 13px;
  color: #b42318;
  margin: -16px 0 20px;
}

.notfound {
  text-align: center;
}
.notfound .code {
  font-size: 13px;
  color: var(--faint);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.notfound h1 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.notfound p { font-size: 14px; color: var(--muted); }
.notfound .login-foot { margin-top: 48px; color: var(--faint); }

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn:hover { background: var(--hover); }
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-primary:active { background: var(--blue-active); }
.btn-primary:focus-visible,
.btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}
.btn-dark {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn-dark:hover { background: #101419; }
.btn-block { width: 100%; padding: 12px 16px; font-size: 15px; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }

/* Header */
.header {
  height: 60px;
  background: var(--surface);
  border-bottom: 2px solid var(--blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.header-accent {
  height: 2px;
  background: var(--yellow);
  opacity: 0.6;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--blue);
  text-decoration: none;
}
.logo:hover { color: var(--blue-hover); }
.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--blue);
  flex-shrink: 0;
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
}
.who-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.who-sep { color: var(--border); }
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
}
.logout {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.logout:hover { color: var(--text); }

.shell {
  background: var(--page);
}
.page {
  background: var(--page);
  padding: 24px;
  min-height: calc(100vh - 62px);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a:hover { color: var(--blue-hover); }
.breadcrumb .sep { color: var(--faint); }
.breadcrumb .here {
  color: var(--text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ico-home {
  width: 16px;
  height: 16px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.grid-head, .grid-row {
  display: grid;
  grid-template-columns: 1fr 120px 160px;
  padding: 12px 16px;
  align-items: center;
}
.grid-head {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--head);
  border-bottom: 1px solid var(--border);
}
.grid-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
}
.grid-row:last-child { border-bottom: none; }
.grid-row:hover { background: var(--hover); }
.grid-row.selected { background: var(--blue-soft); }
.cell-muted { font-size: 13px; color: var(--muted); }

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.name-cell .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radio {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--radio);
  flex-shrink: 0;
}
.grid-row.selected .radio {
  border: none;
  background: var(--blue);
}

.ico-folder {
  width: 18px;
  height: 18px;
  color: var(--blue);
}
.ico-file {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.empty, .state {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}
.warn-card {
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
}
.warn-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.warn-card p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

@keyframes ts-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.shimmer {
  background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 37%, #eef0f3 63%);
  background-size: 400px 100%;
  animation: ts-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

.links-head, .links-row {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 1.1fr 0.9fr 250px;
  padding: 14px 16px;
  align-items: center;
  font-size: 13px;
}
.links-head {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--head);
  border-bottom: 1px solid var(--border);
}
.links-row { border-bottom: 1px solid var(--border); }
.links-row:last-child { border-bottom: none; }
.links-row .name { font-weight: 600; }
.links-row .path, .links-row .exp { color: var(--muted); }
.links-row .short { color: var(--blue); }
.links-row .none { color: var(--faint); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Overlay / modal */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.modal {
  width: 440px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  overflow: visible;
  background: var(--surface);
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.2);
}
.modal.wide { width: 460px; padding: 32px; }
.modal.narrow { width: 380px; padding: 26px 28px; }
.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal-top h2, .modal h2 { font-size: 17px; font-weight: 600; }
.modal-path { font-size: 12px; color: var(--muted); margin-top: 2px; }
.close {
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  background: none;
  border: none;
}
.hint-box {
  background: var(--head);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.hint-box .lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.hint-box .val {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field { margin-bottom: 16px; }
.field label, .field .lbl {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="date"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.field input:focus {
  border-color: var(--blue);
  outline: 2px solid var(--yellow);
}
.slug {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.slug-pre {
  background: var(--head);
  color: var(--muted);
  font-size: 13px;
  padding: 10px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.slug input {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  min-width: 0;
  outline: none;
}
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }
.err { font-size: 12px; color: #b42318; margin-top: 6px; }
.radios { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.radios label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 8px;
}
.field label.check-row { font-weight: 400; }
.check-row input { accent-color: var(--blue); }
.adv-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.adv-toggle:hover { color: var(--blue-hover); }
.adv-toggle .chev {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transition: transform 0.15s ease;
}
.adv-toggle.open .chev { transform: rotate(90deg); }
.exp-until { flex-wrap: wrap; }
.date-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 160px;
}
.date-field input {
  width: 100%;
  padding-right: 36px !important;
}
.cal-open {
  position: absolute;
  right: 8px;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.cal-open::before {
  content: "";
  display: block;
  width: 16px;
  height: 15px;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  box-shadow: inset 0 4px 0 var(--blue-soft);
}
.cal {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 5;
  width: 268px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  padding: 12px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}
.cal-head button {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}
.cal-head button:hover { background: var(--hover); }
.cal-dows, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-dows {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.cal-grid button {
  height: 30px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.cal-grid button:hover { background: var(--hover); }
.cal-grid button.muted { color: var(--faint); }
.cal-grid button.today { font-weight: 700; }
.cal-grid button.picked {
  background: var(--blue);
  color: #fff;
}
.cal-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
.cal-foot button {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.ok-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.ok-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.copy-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.copy-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.copy-row.tight { margin-bottom: 14px; }
.copy-val {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}
.copy-val.main {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: var(--blue);
}
.copy-val.sub {
  background: var(--head);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
  padding: 8px 10px;
}
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 24px; }
.confirm-text { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 8px 0 22px; }

.cards { display: none; }
.file-card, .link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-card.selected {
  background: var(--blue-soft);
  border-color: var(--blue-border);
}
.file-card strong, .link-card strong { font-size: 14px; font-weight: 600; display: block; }
.file-card small, .link-card small { font-size: 11px; color: var(--muted); }
.link-card { cursor: default; padding: 14px; border-radius: 10px; }
.link-card .short { font-size: 12px; color: var(--blue); margin-top: 6px; }
.link-card .none { font-size: 12px; color: var(--faint); margin-top: 6px; }
.link-card .actions { margin-top: 10px; }
.link-card .actions .btn { flex: 1; min-height: 36px; }

@media (max-width: 800px) {
  .header { padding: 0 16px; height: 52px; }
  .logo { font-size: 14px; }
  .logo-mark { width: 18px; height: 18px; border-radius: 6px; }
  .who-sep { display: none; }
  .page { padding: 16px; min-height: calc(100vh - 54px); }
  .page-head { flex-wrap: wrap; }
  .page-head .btn { width: 100%; padding: 11px; }
  .table { display: none; }
  .cards { display: flex; flex-direction: column; gap: 8px; }
  .cards.links { gap: 10px; }
}
