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

:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --sidebar-bg: #1A1A2E;
  --sidebar-hover: #16213E;
  --accent: #E8602C;
  --accent-light: #FDE8DF;
  --text: #1A1A2E;
  --text-muted: #7A7A8C;
  --border: #E8E6DF;
  --urgent: #C0392B;
  --urgent-bg: #FEF2F2;
  --success: #27AE60;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(26,26,46,0.08);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- LOGIN ---- */

#login-view {
  display: flex;
  min-height: 100vh;
}

.login-wrap {
  width: 480px;
  min-width: 380px;
  padding: 60px 56px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 48px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.8rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 8px;
}

.login-sub {
  color: var(--text-muted);
  margin-bottom: 36px;
  font-size: 0.95rem;
}

.login-aside {
  flex: 1;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-aside::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.08;
  top: -100px;
  right: -100px;
}

.login-aside::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.05;
  bottom: -80px;
  left: -60px;
}

.aside-quote {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ---- FORM FIELDS ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field input,
.field select {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  background: white;
}

.error-msg {
  color: var(--urgent);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: 8px;
}

/* ---- BUTTONS ---- */

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}

.btn-primary.small {
  width: auto;
  padding: 9px 18px;
  font-size: 0.88rem;
}

.btn-primary:hover { background: #D04F20; }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 11px 20px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-ghost:hover { border-color: var(--text-muted); }

/* ---- APP LAYOUT ---- */

#main-view {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 32px;
}

.sidebar-brand .brand-name {
  color: white;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  user-select: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--accent);
  color: white;
}

.btn-logout {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  padding: 10px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
}

.main-content {
  flex: 1;
  padding: 40px 48px;
  overflow-y: auto;
  max-width: 900px;
}

/* ---- PAGE HEADER ---- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  font-weight: 400;
}

.page-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- STATS ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card.urgent {
  border-color: #FECACA;
  background: var(--urgent-bg);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-card.urgent .stat-label { color: var(--urgent); }

.stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  color: var(--text);
  line-height: 1;
}

.stat-card.urgent .stat-value { color: var(--urgent); }

/* ---- DEADLINE LIST ---- */

.deadline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deadline-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.15s;
}

.deadline-item:hover { border-color: #C8C5BC; }

.deadline-item.is-urgent {
  border-color: #FECACA;
  background: var(--urgent-bg);
}

.deadline-item.is-closed {
  opacity: 0.5;
}

.deadline-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.deadline-client {
  font-weight: 600;
  font-size: 0.95rem;
}

.deadline-type {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.deadline-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deadline-date {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.deadline-item.is-urgent .deadline-date { color: var(--urgent); }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 20px;
}

.badge-open { background: #D1FAE5; color: #065F46; }
.badge-closed { background: var(--border); color: var(--text-muted); }
.badge-urgent { background: #FEE2E2; color: var(--urgent); }

.deadline-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.close:hover { color: var(--success); }
.btn-icon.del:hover { color: var(--urgent); }

/* ---- CLIENTS GRID ---- */

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.client-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}

.client-card:hover { border-color: #C8C5BC; }

.client-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.client-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.client-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* ---- MODAL ---- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 36px;
  width: 440px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(26,26,46,0.2);
}

.modal-box h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-actions .btn-primary {
  width: auto;
}

/* ---- UTILS ---- */

/* ---- FILTER BAR ---- */

.filter-bar {
  margin-bottom: 16px;
}

.filter-bar select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 200px;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- UPCOMING LIMIT SELECTOR ---- */

#upcoming-limit {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: 64px;
}

#upcoming-limit:focus,
#upcoming-limit:hover {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
}

/* ---- LANGUAGE SELECTOR ---- */

.lang-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  appearance: none;
}

.sidebar-lang {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  padding: 8px 10px;
  width: 100%;
  margin-bottom: 6px;
}

.sidebar-lang:hover,
.sidebar-lang:focus {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
  outline: none;
}

.sidebar-lang option {
  background: var(--sidebar-bg);
  color: white;
}

.login-lang {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 8px 10px;
  width: 100%;
  margin-top: 12px;
}

.login-lang:hover,
.login-lang:focus {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

/* ---- UTILITIES ---- */

.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}