:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5b6777;
  --line: #d5dce5;
  --accent: #c45c26;
  --accent-dark: #9a4318;
  --sidebar: #1a2330;
  --sidebar-text: #c9d2de;
  --success: #1f7a4d;
  --info: #2a6f97;
  --danger: #b42318;
  --warning: #b54708;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --font: "DM Sans", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 92, 38, 0.08), transparent 55%),
    linear-gradient(180deg, #f5f7fa 0%, var(--bg) 100%);
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #152033 0%, var(--sidebar) 100%);
  color: var(--sidebar-text);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.75rem; align-items: center; padding: 0.25rem 0.5rem; }
.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: transparent;
  flex-shrink: 0;
}
.brand strong { display: block; color: #fff; font-size: 0.95rem; }
.brand small { color: #8fa0b5; font-size: 0.75rem; }
.nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-link {
  color: var(--sidebar-text);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: #fff; }
.nav-link.is-active { background: rgba(196, 92, 38, 0.22); color: #fff; }
.sidebar-foot { display: flex; flex-direction: column; gap: 0.75rem; }
.lang-switch { display: flex; gap: 0.35rem; padding: 0 0.5rem; }
.lang-switch a {
  color: #8fa0b5; font-size: 0.8rem; font-weight: 600;
  padding: 0.25rem 0.5rem; border-radius: 6px; text-decoration: none;
}
.lang-switch a.is-active { background: rgba(255,255,255,0.1); color: #fff; }
.logout { opacity: 0.85; }

.main { padding: 1.5rem 1.75rem 2.5rem; max-width: 1400px; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 1.65rem; letter-spacing: -0.02em; }
.page-header p { margin: 0.35rem 0 0; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border: 1px solid transparent; border-radius: 8px; padding: 0.55rem 0.95rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: #b7c2d0; color: var(--ink); }
.btn-danger { background: #fff; border-color: #f0b4ae; color: var(--danger); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.card h2, .card h3 { margin: 0 0 0.85rem; font-size: 1.05rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.2rem; letter-spacing: -0.03em; }

.tabs {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  margin-bottom: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem;
}
.tab {
  padding: 0.45rem 0.85rem; border-radius: 999px; color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.tab:hover { text-decoration: none; color: var(--ink); background: rgba(28,36,48,0.04); }
.tab.is-active { background: var(--ink); color: #fff; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
}
table.data th, table.data td {
  text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.data tr:hover td { background: #f8fafc; }

.badge {
  display: inline-flex; align-items: center; padding: 0.15rem 0.5rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #e8f6ef; color: var(--success); }
.badge-info { background: #e8f2f8; color: var(--info); }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-warning { background: #fff4e5; color: var(--warning); }
.badge-muted { background: #eef1f4; color: var(--muted); }

.form-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="file"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.55rem 0.7rem; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }

.flash {
  padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500;
}
.flash-success { background: #e8f6ef; color: var(--success); }
.flash-error { background: #fdecea; color: var(--danger); }

.empty { color: var(--muted); padding: 1rem 0; }

.filters {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem;
}
.filters .field { min-width: 160px; }

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.kanban-col {
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 280px;
  padding: 0.65rem;
}
.kanban-col h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  margin-bottom: 0.55rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; }
.kanban-col.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.kanban-card .title { font-weight: 600; margin-bottom: 0.35rem; }
.kanban-card .meta { font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.15rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0.75rem 0 0.75rem 1.25rem;
  border-left: 2px solid var(--line);
  margin-left: 0.4rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px; top: 1.1rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.media-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.media-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.media-item .body { padding: 0.55rem 0.65rem; font-size: 0.85rem; }
.media-file {
  display: flex; align-items: center; justify-content: center;
  height: 120px; background: #f3f5f8; font-weight: 700; color: var(--muted);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(26,35,48,0.92), rgba(26,35,48,0.75)),
    radial-gradient(800px 400px at 80% 20%, rgba(196,92,38,0.35), transparent);
}
.login-card {
  width: min(400px, 92vw);
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: transparent;
  margin: 0 auto 1rem;
}
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.45rem; text-align: center; }
.login-card p { margin: 0 0 1.25rem; color: var(--muted); text-align: center; }
.login-card .field { margin-bottom: 0.9rem; }
.login-card .btn { width: 100%; }

.pipeline-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.pipeline-card:hover {
  border-color: #b7c2d0;
  transform: translateY(-1px);
  text-decoration: none;
}
.pipeline-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.pipeline-card .sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.65rem; }

.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
}
