@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #66706d;
  --line: #dfe4df;
  --surface: #fafaf7;
  --panel: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --amber: #b45309;
  --danger: #b42318;
  --blue: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login form {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

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

.sidebar {
  background: #12302d;
  color: white;
  padding: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f5c978;
  color: #12302d;
}

.mini-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 4px;
  border: 1px solid currentColor;
  font-weight: 800;
  line-height: 1;
}

.brand span,
.topbar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand span {
  color: #c7d9d5;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav button,
.ghost,
.primary,
.danger,
.secondary {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 14px;
}

.sidebar nav button {
  justify-content: flex-start;
  color: #edf8f6;
  background: transparent;
}

.sidebar nav button.active,
.sidebar nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.page {
  padding: 24px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.metric,
.panel,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

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

.full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.helper-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.helper-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.file-button {
  cursor: pointer;
  color: var(--primary-dark);
}

.file-button input {
  display: none;
}

.pdf-upload-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

.pdf-upload-box span,
.muted-line {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.muted-inline {
  color: var(--muted);
}

.primary {
  background: var(--primary);
  color: white;
}

.secondary {
  background: #e7f2f0;
  color: var(--primary-dark);
}

.ghost {
  background: transparent;
  color: var(--ink);
}

.danger {
  background: #fee4e2;
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f3f6f2;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2ff;
  color: var(--blue);
  font-size: 12px;
}

.badge.amber {
  background: #fff7ed;
  color: var(--amber);
}

.badge.red {
  background: #fee4e2;
  color: var(--danger);
}

.error {
  color: var(--danger);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, 1fr);
  }

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