:root {
  --bg: #fafbfc;
  --panel: #ffffff;
  --text: #1a1f36;
  --text-secondary: #4a5568;
  --muted: #6b7280;
  --brand: #204773;
  --brand-dark: #163353;
  --brand-light: #d8e3ef;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ea580c;
  --info: #0891b2;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s ease-in-out;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ── App shell layout ─────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────── */
:root {
  --sidebar-w: 256px;
  --sidebar-bg: #173554;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-text: #bfd0e3;
  --sidebar-text-hover: #f9fafb;
  --sidebar-active-bg: rgba(255,255,255,0.16);
  --sidebar-active-text: #ffffff;
  --sidebar-section: #8fa7bf;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: #f9fafb;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
}
.sidebar-brand:hover { color: #fff; text-decoration: none !important; }

.sidebar-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-section);
  padding: 12px 8px 6px;
  margin-top: 4px;
}

.sidebar-menu {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item { display: block; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text-hover);
  text-decoration: none !important;
}
.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-label { flex: 1; }

/* Sidebar submenu */
.sidebar-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 32px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.sidebar-item.has-submenu.open .sidebar-submenu {
  display: flex;
}
.sidebar-item.has-submenu > .sidebar-link {
  position: relative;
}
.sidebar-item.has-submenu > .sidebar-link::after {
  content: '›';
  font-size: 18px;
  font-weight: 700;
  margin-left: auto;
  transition: transform 0.2s ease;
}
.sidebar-item.has-submenu.open > .sidebar-link::after {
  transform: rotate(90deg);
}
.sidebar-submenu .sidebar-link {
  font-size: 13px;
  padding: 7px 10px;
}

/* Sidebar footer — user + logout */
.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(0,0,0,0.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f9fafb;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-section);
}

.sidebar-logout-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-logout-btn:hover {
  background: rgba(220,38,38,0.15);
  color: #f87171;
  text-decoration: none !important;
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* Public sidebar login button */
.sidebar-login-btn {
  width: 100%;
  text-align: center;
  padding: 12px 16px !important;
  border-radius: var(--radius-md) !important;
  font-size: 14px !important;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(32,71,115,0.28);
  transition: all 0.2s ease !important;
}
.sidebar-login-btn:hover {
  box-shadow: 0 4px 16px rgba(32,71,115,0.45);
  transform: translateY(-1px) !important;
}

/* ── Main wrapper ─────────────────────────────────── */
.main-wrapper {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Slim top bar (mobile burger + page title) */
.main-topbar {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.main-topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* Main content area */
.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1280px;
  width: 100%;
}

/* Container (landing page, login page) */
.container { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }

/* Responsive */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .main-topbar {
    display: flex;
  }
  .main-content {
    padding: 20px 16px;
  }
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 0 20px;
}
.hero h1, .page-title { 
  margin: 0; 
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.hero p, .muted { 
  color: var(--text-secondary); 
  font-size: 14px;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.stat-card { 
  padding: 24px; 
  text-align: center;
}
.stat-label { 
  color: var(--text-secondary); 
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value { 
  font-size: 36px; 
  font-weight: 700;
  margin-top: 12px;
  color: var(--brand);
}

/* Clickable stat cards */
.clickable-stat {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.clickable-stat:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
  transform: translateY(-2px);
}

.section { margin: 32px 0; }
.section-header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 16px; 
  margin-bottom: 20px;
}
.section-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-nav .pill {
  min-width: 110px;
  text-align: center;
  font-size: 13px;
  padding: 8px 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 11px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--brand);
  color: white;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
.btn:hover { 
  background: var(--brand-dark); 
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}
.btn.secondary { 
  background: var(--border-light);
  color: var(--text);
  box-shadow: none;
}
.btn.secondary:hover {
  background: var(--border);
  box-shadow: none;
}
.btn.danger { 
  background: var(--danger);
}
.btn.danger:hover {
  background: #b91c1c;
}
.btn.success {
  background: var(--success);
}
.btn.success:hover {
  background: #15803d;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.btn-sm:hover {
  box-shadow: none;
  transform: none;
}
.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.action-group form {
  margin: 0;
}

/* ── Action dropdown menu ─────────────────────────── */
.action-dropdown {
  position: relative;
  display: inline-block;
}
.action-dropdown-toggle {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 10px;
  transition: var(--transition);
}
.action-dropdown-toggle:hover {
  background: var(--border);
}
.action-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
}
.action-dropdown-menu.open {
  display: block;
}
.action-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.action-dropdown-item:hover {
  background: var(--border-light);
  text-decoration: none;
  color: var(--text);
}
.action-dropdown-item--danger {
  color: var(--danger);
}
.action-dropdown-item--danger:hover {
  background: #fef2f2;
  color: var(--danger);
}
.action-dropdown-item--success {
  color: var(--success);
}
.action-dropdown-item--success:hover {
  background: #f0fdf4;
  color: var(--success);
}
.action-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.action-dropdown-menu form {
  margin: 0;
}
.table-wrap { 
  overflow-x: auto;
  border-radius: var(--radius-md);
}
table { 
  width: 100%; 
  border-collapse: collapse;
  font-size: 14px;
}
th, td { 
  padding: 16px 14px; 
  border-bottom: 1px solid var(--border); 
  text-align: left; 
  vertical-align: middle;
}
th { 
  font-size: 12px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  background: var(--border-light);
}
tr:hover {
  background: var(--border-light);
}
.pill { 
  display: inline-block; 
  padding: 6px 12px; 
  border-radius: 999px; 
  background: var(--border-light);
  color: var(--text);
  font-size: 12px; 
  font-weight: 600;
}
.pill.success {
  background: #d4edda;
  color: #155724;
}
.pill.warning {
  background: #fff3cd;
  color: #856404;
}
.pill.danger {
  background: #f8d7da;
  color: #721c24;
}
.message {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 20px 0;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.success { 
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}
.message.error { 
  border-color: #fca5a5;
  background: #fef2f2;
  color: var(--danger);
}
.message.warning {
  border-color: #fed7aa;
  background: #fffbeb;
  color: #92400e;
}
.message::before {
  content: "✓";
  display: inline-flex;
  font-weight: 700;
  font-size: 16px;
}
.message.error::before { content: "✕"; }
.message.warning::before { content: "⚠"; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { 
  font-weight: 600; 
  font-size: 14px;
  color: var(--text);
}
.required {
  color: var(--danger);
  margin-left: 4px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
  background: #fafbff;
}
input::placeholder {
  color: var(--muted);
}
textarea { 
  min-height: 120px; 
  resize: vertical;
}
.error-text { 
  color: var(--danger); 
  font-size: 13px;
  font-weight: 500;
}
.actions { 
  display: flex; 
  gap: 12px; 
  flex-wrap: wrap; 
  margin-top: 24px;
}
.panel { 
  padding: 24px;
}
.client-profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.client-profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow);
}
.client-profile-card span,
.section-count,
.contract-timeline span,
.contract-meta span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
}
.client-profile-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.1;
}
.client-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 20px;
}
.client-overview-card,
.domains-card,
.service-group-card,
.prepaid-card {
  border-radius: var(--radius-md);
}
.detail-section-title,
.service-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.detail-section-title h3,
.service-group-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}
.detail-section-title p,
.service-group-header p {
  margin: 3px 0 0;
}
.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 76px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border-light);
  padding: 14px;
}
.detail-list .full {
  grid-column: 1 / -1;
  min-height: auto;
}
.detail-list span,
.domain-item .muted {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
}
.detail-list strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.domain-list,
.service-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.domain-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.domain-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.section-count {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  padding: 6px 12px;
}
.service-group-card {
  overflow: hidden;
}
.contract-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.contract-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(26, 31, 54, 0.04);
}
.contract-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.contract-card-top strong {
  color: var(--brand);
  font-size: 20px;
}
.contract-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.contract-timeline div {
  border-radius: var(--radius-sm);
  background: var(--border-light);
  padding: 10px;
}
.contract-timeline strong,
.contract-meta strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.contract-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.prepaid-summary {
  margin-bottom: 20px;
}
.prepaid-summary div {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--border-light);
}
.prepaid-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  color: var(--brand);
}
/* ── Calendar redesign ─────────────────────────────── */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.calendar-day {
  min-height: 72px;
  padding: 8px 10px;
  background: var(--panel);
  transition: background 0.15s ease;
  position: relative;
}
.calendar-day:hover {
  background: #f8fafc;
}
.calendar-head {
  background: var(--sidebar-bg);
  color: rgba(255,255,255,0.85);
  text-align: center;
  font-weight: 600;
  min-height: auto;
  padding: 10px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.calendar-head:hover {
  background: var(--sidebar-bg);
}
.calendar-empty {
  background: var(--border-light);
}
.calendar-empty:hover {
  background: var(--border-light);
}

/* Today highlight */
.calendar-day.is-today {
  background: #edf3f9;
}
.calendar-day.is-today .day-num {
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.calendar-day .day-num {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

/* Renewal event chip */
.renewal-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #d8e3ef 0%, #edf3f9 100%);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-dark);
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  border: 1px solid rgba(32,71,115,0.14);
}
.renewal-item:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(32,71,115,0.3);
}
.renewal-item .renewal-service {
  display: block;
  font-weight: 400;
  font-size: 10px;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Event count badge for days with multiple events */
.renewal-more {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--brand-light);
  transition: all 0.15s ease;
}
.renewal-more:hover {
  background: var(--brand);
  color: #fff;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}
.modal.show { display: flex; }
.modal-card { 
  width: min(720px, 100%);
  max-height: 85vh;
  overflow: auto;
  border-radius: var(--radius-lg);
}
.modal-card .panel { 
  position: relative;
  border-radius: var(--radius-lg);
}
.close-btn {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  background: var(--border-light);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.close-btn:hover {
  background: var(--border);
  color: var(--text);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.domain-row { display: flex; gap: 12px; margin-bottom: 12px; }
.domain-row input { flex: 1; }
.muted-box {
  border: 1px dashed var(--border);
  background: var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.landing-shell {
  display: grid;
  gap: 32px;
  padding: 40px 0 50px;
}
.landing-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: center;
  padding: 40px;
  overflow: hidden;
  position: relative;
}
.landing-hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32, 71, 115, 0.12), transparent 68%);
  pointer-events: none;
}

.public-navbar {
  border-bottom-color: #d8e3ef !important;
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
}

.public-brand:hover {
  color: var(--brand-dark);
}

.public-brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.auth-brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.landing-copy h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.15;
  margin: 12px 0 16px;
  max-width: 12ch;
  font-weight: 700;
  color: var(--text);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.landing-copy p {
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 24px;
}
.landing-panel {
  display: flex;
  align-items: stretch;
}
.landing-stat {
  width: 100%;
  background: linear-gradient(135deg, var(--panel) 0%, var(--border-light) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.landing-stat-list {
  display: grid;
  gap: 12px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}
.landing-stat-list div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.landing-stat-list div::before {
  content: "→";
  color: var(--brand);
  font-weight: 700;
}
.landing-section {
  margin: 0;
}
.landing-section h2,
.feature-card h3 {
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}
.feature-card {
  transition: var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.feature-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.landing-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.landing-cta h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}
.actions { gap: 12px; }

/* Dashboard main layout - calendar and cards side by side */
.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

.calendar-section {
  min-width: 0;
}

.cards-section {
  min-width: 0;
}

/* Work orders grid - 1 column (vertical stack) */
.work-orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Work orders accordion */
.work-orders-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.accordion-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

.accordion-header {
  width: 100%;
  padding: 16px;
  background: var(--panel);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  text-align: left;
}

.accordion-header:hover {
  background: var(--border-light);
}

.accordion-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.accordion-title {
  flex: 1;
  min-width: 0;
}

.accordion-title h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-dark);
  word-break: break-word;
}

.accordion-client {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.accordion-chevron {
  flex-shrink: 0;
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--text-secondary);
  font-size: 12px;
}

.accordion-header[aria-expanded="true"] .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content {
  padding: 0 16px 16px 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

/* Work order card styling */
.work-order-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.work-order-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.card-title {
  flex: 1;
  min-width: 0;
}

.card-title h4 {
  word-break: break-word;
  overflow-wrap: break-word;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.field-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.field-row:last-child {
  margin-bottom: 0;
}

.field-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 80px;
  flex-shrink: 0;
}

.field-value {
  color: var(--text);
  text-align: right;
  flex: 1;
  word-break: break-word;
}

.field-value.highlight-renewal {
  color: var(--brand);
  font-weight: 600;
}

.field-row.final-amount {
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  margin-top: 8px;
}

.field-row.final-amount .field-value {
  color: var(--success);
  font-size: 14px;
}

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Text colors and variables */
:root {
  --text-dark: #1a1f36;
}

@media (max-width: 900px) {
  .grid-3, .form-grid, .client-detail-grid, .detail-list, .client-profile-summary, .contract-card-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .calendar-day { min-height: 60px; padding: 6px; }
  .calendar-day .day-num { font-size: 11px; }
  .renewal-item { font-size: 10px; padding: 3px 5px; }
  .contract-timeline, .contract-meta { grid-template-columns: 1fr; }
  .landing-hero { grid-template-columns: 1fr; padding: 28px; gap: 24px; }
  .landing-copy h1 { max-width: none; font-size: 32px; }
  .landing-cta { flex-direction: column; align-items: flex-start; }

  /* Dashboard responsive - stack on tablet */
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  /* Work orders grid - 1 column on tablet */
  .work-orders-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  /* Dashboard responsive - single column on mobile */
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  /* Work orders grid - 1 column on mobile */
  .work-orders-grid {
    grid-template-columns: 1fr;
  }
  
  /* Adjust card fields for mobile */
  .field-row {
    flex-direction: column;
    gap: 4px;
  }
  
  .field-label {
    min-width: auto;
  }
  
  .field-value {
    text-align: left;
  }
}
