:root {
  --navy: #11274a;
  --navy-2: #1b3765;
  --gold: #c8962a;
  --gold-2: #d8ac43;
  --ice: #eef3fb;
  --surface: #ffffff;
  --line: #d6dee8;
  --text: #1c2742;
  --muted: #5b6b84;
  --shadow: 0 10px 30px rgba(18, 35, 70, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, #eaf0fb 0%, #f7f9fd 60%, #ffffff 100%);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  font-size: 15px;
}

.page {
  max-width: 1200px;
  margin: 28px auto 60px;
  padding: 0 20px;
}

h1, h2 {
  font-family: "Georgia", "Times New Roman", serif;
  margin: 0 0 12px;
  color: var(--navy);
}

.top {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.top h1 { color: #fff; margin: 0; }
.top a {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.top a:hover { background: rgba(255, 255, 255, 0.22); }
.top .nav-btn {
  text-decoration: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.top .nav-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #10213c;
  border-color: #d2a63b;
}
.top .nav-primary:hover { filter: brightness(1.03); }
.top .nav-secondary {
  background: var(--navy-2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.top .nav-secondary:hover { background: #254477; }

.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.msg {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f4f7fb;
  font-size: 16pt;
}
.msg.error { color: #a0152d; border-color: #f1b7c0; background: #fff1f3; }
.msg.success { color: #0a7a2f; border-color: #bfe5c9; background: #f1fbf4; }
.msg.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  width: min(520px, calc(100% - 40px));
  text-align: center;
  margin: 0;
  box-shadow: var(--shadow);
}
.msg.popup.hide {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

label {
  font-weight: 600;
  color: var(--navy);
  padding-left: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
}
.form-grid .full {
  grid-column: 1 / -1;
}
.form-grid .form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}
.form-actions {
  display: flex;
  justify-content: center;
}
.form-separator {
  margin-top: 12px;
  margin-bottom: 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fdfdff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

input[type="file"] { padding: 6px; }

input:focus,
select:focus {
  outline: none;
  border-color: #8fb0df;
  box-shadow: 0 0 0 3px rgba(95, 140, 210, 0.2);
}

button,
input[type="submit"],
input[type="button"] {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #10213c;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(25, 35, 65, 0.15);
}
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover { filter: brightness(1.03); }
button:active,
input[type="submit"]:active,
input[type="button"]:active { transform: translateY(1px); }

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f7faff;
  border: 1px solid #d6dee8;
  color: var(--navy-2);
  box-shadow: 0 4px 10px rgba(18, 35, 70, 0.08);
}
.icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover {
  background: #eef3fb;
  border-color: #c7d2e5;
}
.icon-btn:active { transform: translateY(1px); }
.is-hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  table-layout: fixed;
  font-size: 13px;
  line-height: 1.2;
}
th, td {
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
td.center-col,
th.center-col {
  padding-left: 8px;
  padding-right: 8px;
}
th.center-col, td.center-col { text-align: center; }
.icon-header { text-align: center; }
.icon-header i { display: inline-block; }
td.actions { text-align: center; }
.center-col { text-align: center; }
tr:last-child td { border-bottom: 0; }
th {
  background: #f3f6fb;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
}

.actions form { display: inline-block; margin-right: 6px; }
.created-col { font-size: 12px; color: var(--muted); }
.col-compact { width: 80px; }
.col-compact { white-space: nowrap; }
.col-narrow { width: 120px; }
.col-wide { width: 240px; }
.col-icon { width: 60px; white-space: nowrap; }
.col-link { width: 320px; }
.col-actions-share { width: 88px; }
.col-title { width: 360px; }
.col-name { width: 200px; }
.col-size { width: 100px; }
.col-created { width: 100px; }
.col-state { width: 100px; }
.col-share { width: 100px; }
.col-client { width: 100px; }
.col-admin { width: 100px; }

.title-form input[type="text"] {
  flex: 1;
  min-width: 140px;
}

.title-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.icon-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 8px;
  background: #f7faff;
  border: 1px solid #d6dee8;
  color: var(--navy-2);
  box-shadow: 0 2px 6px rgba(18, 35, 70, 0.08);
  text-decoration: none;
}
.icon-indicator.is-disabled {
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}
.copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.col-link .copy-wrap {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
}
.col-link .copy-wrap a {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}
.col-actions-share .toggle-group {
  justify-content: flex-start;
  transform: translateX(-10px);
}
.copy-btn i { font-size: 14px; }
.copy-btn.copied {
  background: #11274a;
  border-color: #11274a;
  color: #ffffff;
}
.copy-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.icon-indicator.active {
  background: #11274a;
  border-color: #11274a;
  color: #ffffff;
}

.toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.toggle-group form { margin: 0; }
.icon-indicator svg {
  width: 14px;
  height: 14px;
  display: block;
}
.icon-indicator svg path,
.icon-indicator svg circle,
.icon-indicator svg rect,
.icon-indicator svg polygon {
  stroke: currentColor !important;
  fill: none !important;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: #f4f7fb;
  color: var(--navy-2);
  border: 1px solid #d6dee8;
}
.status-badge svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.status-active {
  background: #11274a;
  color: #ffffff;
  border-color: #11274a;
}
.status-muted {
  background: #f7faff;
  color: var(--navy-2);
  border-color: #d6dee8;
}

.muted { color: var(--muted); }

.auth {
  max-width: 520px;
  margin: 0 auto;
}

.auth h1 { text-align: center; }
.split {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 16px;
  align-items: start;
}
.split .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.file-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 270px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-item label { margin: 0; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.file-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid #d6dee8;
  color: var(--navy-2);
}
.file-names {
  margin: 0;
  padding-left: 16px;
}
.file-names li {
  margin: 2px 0;
}
.upload-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  justify-items: center;
}
.upload-form .file-btn { margin-top: 20px; }
.upload-form button {
  width: fit-content;
}
.upload-form input[type="file"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}
.file-btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #b9c6dd;
  background: #ffffff;
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(18, 35, 70, 0.12);
  cursor: pointer;
  width: fit-content;
}
.file-btn:hover { filter: brightness(0.98); }
.file-name {
  font-size: 16px;
  color: #11274a !important;
}
#upload_file_name,
.upload-form .file-name {
  color: #11274a !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}
.modal-backdrop.is-open { display: flex; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 600px;
  width: 100%;
  overflow: hidden;
}
.modal-header {
  background: var(--navy);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-family: "Georgia", "Times New Roman", serif;
}
.modal-close {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.modal-body {
  padding: 18px 20px 8px;
}
.modal-body #confirmExtra {
  font-weight: 700;
  color: #a0152d;
}
.modal-body #confirmMessage {
  font-weight: 700;
  color: #a0152d;
}
.modal-actions {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}
.modal-cancel {
  background: #f7faff;
  border: 1px solid #d6dee8;
  color: var(--navy-2);
  box-shadow: 0 4px 10px rgba(18, 35, 70, 0.08);
}
