/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f5f7fa;
}

/* === Nav === */
#nav {
  background: #1e293b;
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
#nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
#nav a:hover, #nav a.active { color: #fff; }

/* === Layout === */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2.5rem;
}

/* === Cards === */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

/* === Typography === */
h1 { font-size: 1.75rem; font-weight: 600; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 0.75rem; }
p { margin-bottom: 0.75rem; }
.text-muted { color: #64748b; font-size: 13px; }

/* === Links === */
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
a[target="_blank"]::after { content: " \2197"; font-size: 0.75em; }

/* === Account Link Banner === */
.account_link {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: block;
  font-size: 13px;
}
.account_link span {
  background: #fef9c3;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  word-break: break-all;
}
.copyable {
  cursor: pointer;
  position: relative;
}
.copy-icon {
  vertical-align: middle;
  margin-left: 2px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.copyable:hover .copy-icon { opacity: 1; }
.account_link .copy-toast,
.copy-toast {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeOut 1.5s forwards;
}
@keyframes fadeOut {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
}
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
tr:hover td { background: #f8fafc; }
td .actions { white-space: nowrap; }
td .actions a { margin-right: 0.5rem; font-size: 13px; }
td .actions a.danger { color: #dc2626; }
td .actions a.danger:hover { color: #b91c1c; }

/* === Forms === */
label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 14px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.form-group { margin-bottom: 1rem; }
.form-hint { font-size: 13px; color: #64748b; margin-top: 0.25rem; }
.form-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1rem;
}
.form-row label {
  text-align: right;
  padding-top: 0.5rem;
}
.checkbox-row {
  display: flex;
  align-items: center;
}
.form-row .radio-label {
  display: block;
  font-weight: 400;
  margin-bottom: 0.35rem;
  cursor: pointer;
  text-align: left;
  padding-top: 0;
}
.radio-label input[type="radio"] {
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* === Buttons === */
.btn, input[type="submit"] {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  line-height: 1.5;
}
.btn-primary, input[type="submit"] {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover, input[type="submit"]:hover {
  background: #1d4ed8;
  text-decoration: none;
}
.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger {
  background: #fee2e2;
  color: #dc2626;
}
.btn-danger:hover { background: #fecaca; }
.btn:disabled, input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Lists (dashboard) === */
.account-list {
  list-style: none;
  padding: 0;
}
.account-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0.5rem;
}
.account-list li:last-child { border-bottom: none; }
.account-list li:hover { background: #eff6ff; }
.account-list a {
  font-weight: 500;
  transition: background 0.1s;
  border-radius: 4px;
}
.account-list a:hover {
  text-decoration: none;
}

/* === Alerts === */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 14px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert a { font-weight: 500; }

/* === Badge (slot mode) === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-standard { background: #e0e7ff; color: #3730a3; }
.badge-fixed { background: #fef3c7; color: #92400e; }

/* === Print Schedule (inline overrides) === */
.print-page body { background: #fff; }
.print-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.print-toolbar .text-muted { margin: 0; }

@media print {
  #nav, .print-toolbar { display: none; }
}
