@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f0f2f5;
  --border: #dde1e7;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --accent: #0a3060;
  --accent-hover: #0d4080;
  --accent-light: #e8f0fb;
  --active: #1a6b3c;
  --active-bg: #e6f4ed;
  --draft: #7c5c00;
  --draft-bg: #fef9e7;
  --completed: #1e5a8e;
  --completed-bg: #e8f2fb;
  --deleted: #7f1d1d;
  --deleted-bg: #fef2f2;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 10px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
}

/* HEADER */
header {
  background: var(--accent);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo-mark {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; letter-spacing: -1px;
}

header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

header h1 span { opacity: 0.7; font-size: 13px; font-family: 'DM Sans', sans-serif; display: block; font-weight: 400; }

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

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: white; color: var(--accent); }
.btn-primary:hover { background: #f0f6ff; }

.btn-ghost { background: rgba(255,255,255,0.12); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn-ghost:hover { background: rgba(255,255,255,0.2); }

.btn-outline { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-save { background: var(--accent); color: white; }
.btn-save:hover { background: var(--accent-hover); }
.btn-completed { background: var(--active-bg); color: var(--active); border: 1px solid #a7d7b8; }
.btn-completed:hover { background: #d0eddb; }

/* TOOLBAR */
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}

input[type="search"], input[type="text"], input[type="date"], select, textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: border-color 0.15s;
}

input[type="search"]:focus, input[type="text"]:focus, input[type="date"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,48,96,0.08);
}

.search-input {
  width: 100%;
  padding: 8px 10px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
}

.search-input:focus { outline: none; border-color: var(--accent); background: white; box-shadow: 0 0 0 3px rgba(10,48,96,0.08); }

.filter-select {
  padding: 8px 28px 8px 10px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.count-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  margin-left: auto;
}

/* MAIN */
main { padding: 24px 32px; max-width: 1800px; margin: 0 auto; }

/* TABLE */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

thead { background: var(--surface2); }

th {
  padding: 13px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--accent); }
th .sort-arrow { opacity: 0.4; margin-left: 4px; }
th.sorted .sort-arrow { opacity: 1; color: var(--accent); }

td {
  padding: 13px 18px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.row-num { color: var(--text-muted); font-size: 12px; width: 36px; }

/* STATUS BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-dot { width: 6px; height: 6px; border-radius: 50%; }

.badge-Active    { background: var(--active-bg);    color: var(--active);    }
.badge-Active    .badge-dot { background: var(--active);    }
.badge-Draft     { background: var(--draft-bg);     color: var(--draft);     }
.badge-Draft     .badge-dot { background: var(--draft);     }
.badge-Completed { background: var(--completed-bg); color: var(--completed); }
.badge-Completed .badge-dot { background: var(--completed); }
.badge-Deleted   { background: var(--deleted-bg);   color: var(--deleted);   }
.badge-Deleted   .badge-dot { background: var(--deleted);   }

.gcc-number { font-weight: 600; color: var(--accent); font-size: 14px; }

.action-btns { display: flex; gap: 4px; }

.icon-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.icon-btn:hover     { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.icon-btn.del:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; margin-bottom: 4px; color: var(--text); font-weight: 500; }
.empty-state small { font-size: 13px; }

/* SLIDE PANEL */
.panel-overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,40,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
}

.panel-overlay.open { opacity: 1; pointer-events: all; }

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(1150px, 95vw);
  background: var(--surface);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.panel.open { transform: translateX(0); }

.panel-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
}

.panel-title { font-family: 'DM Serif Display', serif; font-size: 22px; font-weight: 400; }

.panel-close {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.panel-close:hover { background: var(--border); color: var(--text); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface);
}

/* FORM */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

input[type="text"], input[type="date"], select { padding: 11px 14px; width: 100%; font-size: 15px; }
textarea { padding: 11px 14px; width: 100%; resize: vertical; min-height: 110px; line-height: 1.6; font-size: 15px; }

/* VIEW MODE */
.view-field { margin-bottom: 2px; }
.view-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.view-value { font-size: 15px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.view-value.empty { color: var(--text-muted); font-style: italic; }
.view-section { background: var(--surface2); border-radius: 8px; padding: 16px 20px; }
.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* DIVIDER */
.divider {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
}

/* IMPORT */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.import-zone:hover, .import-zone.drag-over { border-color: var(--accent); background: var(--accent-light); }
.import-zone p { font-size: 14px; color: var(--text); margin: 8px 0 4px; font-weight: 500; }
.import-zone small { font-size: 12px; color: var(--text-muted); }

#fileInput { display: none; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #1a6b3c; }
.toast.error   { background: #b91c1c; }

/* STATS BAR */
.stats-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.stat-card:hover { border-color: var(--accent); }
.stat-card.active-filter { border-color: var(--accent); background: var(--accent-light); }
.stat-card .stat-num   { font-weight: 700; font-size: 22px; line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }

/* RESPONSIVE */
@media (max-width: 640px) {
  header { padding: 0 14px; }
  header h1 { font-size: 15px; }
  main { padding: 12px 14px; }
  .toolbar { padding: 10px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .view-grid { grid-template-columns: 1fr; }
  td, th { padding: 9px 10px; }
}
