:root {
  /* Ocean & Coral theme */
  --bg: #eef3f8;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #075985;            /* deep ocean */
  --accent-2: #0284c7;          /* ocean blue */
  --teal: #0d9488;              /* lagoon */
  --coral: #f43f5e;             /* coral */
  --violet: #7c3aed;
  --emerald: #059669;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(2, 84, 133, .06), 0 4px 14px rgba(2, 84, 133, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, #0c4a6e 0%, #0f2e4d 55%, #0f172a 100%);
  padding: 18px 0; position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.brand { padding: 0 20px 14px; }
.brand-name { display: block; font-size: 12px; letter-spacing: .08em; color: #7dd3fc; font-weight: 700; }
.brand-sub { display: block; font-size: 19px; font-weight: 700; color: #fff; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a {
  padding: 8px 20px; font-weight: 600; font-size: 14px; color: #cbd8e6; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active {
  border-left-color: #38bdf8; color: #fff;
  background: linear-gradient(90deg, rgba(56, 189, 248, .22), rgba(56, 189, 248, .04));
}
.sidebar nav a.disabled { color: #56718c; pointer-events: none; }
.nav-group {
  padding: 16px 20px 5px; font-size: 11px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
  border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 6px;
}
.nav-group::before {
  content: ""; width: 8px; height: 8px; border-radius: 3px; background: currentColor;
  display: inline-block; flex: 0 0 auto;
}
.ng-sales   { color: #38bdf8; }   /* sky */
.ng-ops     { color: #fb7185; }   /* coral */
.ng-pur     { color: #a78bfa; }   /* violet */
.ng-acct    { color: #2dd4bf; }   /* lagoon teal */
.ng-hr      { color: #f472b6; }   /* pink */
.ng-admin   { color: #94a3b8; }   /* slate */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; position: sticky; top: 0; z-index: 5;
}
.workspace { font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }
.content { padding: 28px 24px; max-width: 1280px; width: 100%; }

/* Components */
h1 { font-size: 24px; margin: 0 0 20px; }
.content > h1::after, .page-head h1::after {
  content: ""; display: block; width: 46px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #0ea5e9, #14b8a6, #f43f5e); margin-top: 8px;
}
h2 { font-size: 18px; margin: 24px 0 12px; }
.chip {
  background: #eef1f6; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600;
}
.chip-dark { background: var(--accent); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  --c: var(--accent-2);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, #fff) 0%, #fff 60%);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  border-top: 4px solid var(--c); transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(2, 84, 133, .16); }
/* Ocean & Coral card colors cycle automatically — no yellow */
.cards .card:nth-child(6n+1) { --c: #0284c7; }  /* ocean */
.cards .card:nth-child(6n+2) { --c: #0d9488; }  /* lagoon */
.cards .card:nth-child(6n+3) { --c: #7c3aed; }  /* violet */
.cards .card:nth-child(6n+4) { --c: #f43f5e; }  /* coral */
.cards .card:nth-child(6n+5) { --c: #059669; }  /* palm green */
.cards .card:nth-child(6n+6) { --c: #4f46e5; }  /* indigo */
.card .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.card .value { font-size: 30px; font-weight: 700; margin-top: 6px;
  color: color-mix(in srgb, var(--c) 72%, #0f172a); }
.card.warn { --c: var(--danger) !important; }
.card.warn .value { color: var(--danger); }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.list th { background: #f0f7fc; color: #256a92; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
table.list tr:hover td { background: #f7fbfe; }
table.list tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-block; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #f6f8fb; }
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #1d4ed8);
  border-color: transparent; color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, #0369a1, #1e40af); }
.btn-ghost { border: none; background: none; color: var(--muted); }
.btn-done { background: #dcfce7; border-color: #86efac; color: #166534; }
.btn-done:hover { background: #bbf7d0; }
.btn-posted { background: #e0f2fe; border-color: #7dd3fc; color: #075985; }
.btn-posted:hover { background: #bae6fd; }

/* Colorful quick actions (dashboard) */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.qa {
  display: inline-block; padding: 11px 18px; border-radius: 10px; font-weight: 700;
  font-size: 14px; color: #fff; box-shadow: var(--shadow);
  transition: transform .12s ease, filter .12s ease;
}
.qa:hover { transform: translateY(-2px); filter: brightness(1.08); }
.qa-blue   { background: linear-gradient(135deg, #0284c7, #1d4ed8); }
.qa-teal   { background: linear-gradient(135deg, #0d9488, #0f766e); }
.qa-green  { background: linear-gradient(135deg, #059669, #047857); }
.qa-violet { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.qa-coral  { background: linear-gradient(135deg, #f43f5e, #be123c); }
.qa-indigo { background: linear-gradient(135deg, #4f46e5, #4338ca); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.inline { display: inline; }

form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent-2); }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }

.flash {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-red { background: #fee2e2; color: #991b1b; }
.muted { color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

/* Warning flash (coral, not yellow) */
.flash-warn { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-warn a { text-decoration: underline; font-weight: 700; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0c4a6e 0%, #155e75 45%, #0f766e 100%); }
.login-card { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 36px; width: 380px; max-width: calc(100vw - 32px); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* Mobile */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -240px; transition: left .2s ease; z-index: 20; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .menu-btn { display: block; color: #0f172a; }
  .content { padding: 20px 14px; }
  .cards { grid-template-columns: 1fr 1fr; }
  /* Wide tables scroll sideways instead of breaking the page */
  table.list { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Bigger touch targets */
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 7px 12px; }
  .sidebar nav a { padding: 12px 20px; }
  .qa { padding: 13px 18px; flex: 1 1 44%; text-align: center; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .topbar .chip:not(.chip-dark) { display: none; }
}

/* Phase 2 additions */
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; max-width: 420px; }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar .chip { border: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.overdue { color: var(--danger); font-weight: 700; }
.badge-blue { background: #e0f2fe; color: #075985; }
.badge-amber { background: #ffe4e6; color: #9f1239; }  /* coral now — no yellow */
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-teal { background: #ccfbf1; color: #115e59; }
.job-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.job-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: block; }
.job-card:hover { outline: 2px solid #bfdbfe; }
.jc-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 6px; }
.jc-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.jc-meta { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.progressbar { height: 8px; background: #e8ecf3; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progressbar > div { height: 100%; background: linear-gradient(90deg, #0ea5e9, #14b8a6); border-radius: 999px; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.tl-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 8px; }
.photo-grid img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }
input[type=range] { width: 100%; }
