:root {
  --bg: #ffffff;
  --panel: #f8fbff;
  --panel-strong: #f1f6fc;
  --text: #173252;
  --muted: #5b7190;
  --line: #cfd8e4;
  --line-strong: #bfcddd;
  --accent: #00a9c6;
  --accent-2: #12c7de;
  --sidebar-bg: #253241;
  --sidebar-line: #33475c;
  --success: #0f8f5b;
  --error: #c24d4d;
  --info: #2874a4;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
}

body {
  background-image:
    linear-gradient(to right, rgba(80, 92, 112, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(80, 92, 112, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand {
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 1.55rem;
  margin: 0.35rem 0 0.65rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0.2rem 0 0.55rem;
}

h3 {
  font-size: 0.92rem;
  margin: 0.15rem 0 0.45rem;
}

table,
th,
td,
.badge,
.kicker,
.user-chip,
input,
select,
textarea {
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-line);
  padding: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: block;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-subtitle {
  margin: 0.25rem 0 1.2rem;
  font-size: 0.8rem;
  color: #aac0d5;
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.sidebar-nav a {
  color: #f2f7fd;
  border: 1px solid var(--sidebar-line);
  padding: 0.62rem 0.7rem;
  font-size: 0.86rem;
}

.sidebar-nav a:hover {
  border-color: var(--accent);
  color: #ffffff;
}

.sidebar-nav a[aria-current="page"] {
  border-color: var(--accent);
  background: rgba(0, 169, 198, 0.14);
  color: #ffffff;
}

.content-shell {
  padding: 0.9rem;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.9rem;
}

.topbar {
  border: 1px solid var(--sidebar-line);
  background: var(--sidebar-bg);
  padding: 0.75rem 0.85rem;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.topbar-actions form {
  margin: 0;
}

.user-chip {
  border: 1px solid var(--sidebar-line);
  color: #cceaf0;
  background: transparent;
  padding: 0.42rem 0.58rem;
  font-size: 0.75rem;
}

.kicker {
  margin: 0;
  color: #aac0d5;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.topbar strong {
  color: #ffffff;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
}

.page {
  max-width: 100%;
  padding: 0;
}

.narrow {
  max-width: 840px;
}

.hero,
.panel,
.metric-card,
.card,
.message-block {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none !important;
}

.hero,
.panel,
.card {
  padding: 1rem;
}

.panel {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
  border-color: var(--line-strong);
}

.card {
  background: #f4f8fd;
  border-color: var(--line);
}

.lead,
.helper-text,
label,
.message-meta,
.site-footer {
  color: var(--muted);
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  padding: 0.62rem 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  font-size: 0.76rem;
  transition: color 180ms ease, border-color 180ms ease, background-color 220ms ease;
}

.btn:hover {
  border-color: var(--accent);
  color: #ffffff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.btn-primary {
  border-color: var(--accent);
  color: #ffffff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.btn-secondary,
.btn-ghost {
  border-color: var(--line);
}

.dashboard-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.metric-card {
  padding: 0.75rem;
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

.metric-card p {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 1.25rem;
  color: #0f2f58;
}

.grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.grid > * {
  grid-column: span 4;
}

.two-col {
  grid-template-columns: 2fr 1fr;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  background: #fdfefe;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0.58rem;
  color: var(--text);
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  color: #4d6484;
  text-transform: uppercase;
  font-weight: 500;
  background: #f1f6fc;
}

.badge {
  border: 1px solid transparent;
  padding: 0.15rem 0.48rem;
  font-size: 0.68rem;
  font-weight: 600;
  background: #eef3f8;
  color: #375675;
}

.badge-open {
  background: #e8f9fc;
  color: #0e7e95;
}

.badge-in-progress {
  background: #e6f2ff;
  color: #2866a8;
}

.badge-waiting-on-client {
  background: #fff4de;
  color: #986f12;
}

.badge-resolved,
.badge-closed {
  background: #e7f8f0;
  color: #177347;
}

.form-grid {
  display: grid;
  gap: 0.65rem;
}

.compact {
  gap: 0.5rem;
}

label {
  display: grid;
  gap: 0.32rem;
  font-size: 0.82rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0.58rem;
  font-size: 0.79rem;
}

input::placeholder,
textarea::placeholder {
  color: #7c90ac;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox input {
  width: auto;
}

.flashes {
  display: grid;
  gap: 0.4rem;
}

.flash {
  border: 1px solid var(--line);
  padding: 0.62rem 0.72rem;
  font-size: 0.8rem;
}

.flash-success {
  border-color: var(--success);
  color: #0f8f5b;
}

.flash-error {
  border-color: var(--error);
  color: #c24d4d;
}

.flash-info {
  border-color: var(--info);
  color: #2874a4;
}

.message-block {
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: #f7fbff;
  border-color: var(--line-strong);
}

.message-internal {
  border-color: #9eb0c7;
  background: #edf3fa;
}

.file-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.file-list li {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.4rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 0.8rem 0 1rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .grid > * {
    grid-column: span 6;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .content-shell {
    padding: 0.6rem;
  }

  .topbar-inner,
  .dashboard-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .grid > * {
    grid-column: span 12;
  }
}
