:root {
  --bg: #0f172a;
  --bg-2: #111827;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #0f172a;
  --accent: #2563eb;
  --accent-2: #16a34a;
  --danger: #b91c1c;
  --border: #e5e7eb;
  --chip: #f1f5f9;
}

* {
  box-sizing: border-box;
}

body.app-body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: #f8fafc;
  color: var(--text);
}

body.login-body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: #0f172a;
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.content-only {
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color: #fff;
  padding: 24px 20px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 24px;
}

.nav a {
  display: block;
  color: #cbd5f5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.content {
  padding: 24px 32px 48px;
}

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

.title {
  font-size: 22px;
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

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

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

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.login-card {
  background: #ffffff;
  color: #0f172a;
  border-radius: 14px;
  padding: 28px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.card h4 {
  margin: 0 0 8px;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat .value {
  font-size: 20px;
  font-weight: 700;
}

.badge {
  background: var(--chip);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  justify-content: space-between;
}

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

.apple-input,
.apple-select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
}

.apple-input {
  width: 300px;
}

.month-select {
  width: 140px;
}

.year-select {
  width: 90px;
}

.filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.filter-toggle {
  border-radius: 999px;
  width: auto;
  height: auto;
  padding: 8px 12px;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: #0f172a;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f7;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 16px rgba(0, 0, 0, 0.06);
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(16px);
  transition: max-width 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
}

.filter-panel.open {
  max-width: 560px;
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 980px) {
  .actions {
    width: 100%;
  }
  .filters-right {
    width: 100%;
    justify-content: flex-start;
  }
  .filter-panel {
    width: 100%;
    max-width: 100%;
  }
  .apple-input {
    width: 100%;
  }
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.btn.secondary {
  background: #0f766e;
}

.btn.ghost {
  background: #e2e8f0;
  color: #0f172a;
}

.btn.success {
  background: var(--accent-2);
  color: #fff;
}

.btn.full {
  width: 100%;
}

.btn.loading {
  position: relative;
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.input,
select,
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="file"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  display: block;
}

.error {
  color: var(--danger);
}

.text-success {
  color: var(--accent-2);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 12px;
}

.status-ok {
  color: var(--accent-2);
}

.status-cancel {
  color: var(--danger);
}

.row-cancelled td {
  background: #ffe6df;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-12 {
  margin-bottom: 12px;
}

.ml-8 {
  margin-left: 8px;
}

.inline-form {
  display: inline-block;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-button {
  background: #e2e8f0;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: #2563eb;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.disk-bar {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.disk-bar-fill {
  height: 100%;
}

.disk-fill-low {
  background: #22c55e;
}

.disk-fill-mid {
  background: #f97316;
}

.disk-fill-high {
  background: #ef4444;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
  }
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
