:root {
  --ink-950: #06111f;
  --ink-900: #0b1d35;
  --ink-800: #14304d;
  --ink-600: #4d6680;
  --ink-500: #6b8299;
  --line: #e2e8ed;
  --line-strong: #c8d3dc;
  --surface: #f7f9fb;
  --surface-raised: #ffffff;
  --surface-soft: #eef3f7;
  --surface-tint: #e8f7ef;
  --green-800: #007a3a;
  --green-700: #008c43;
  --green-600: #00a650;
  --green-500: #00bb5b;
  --green-300: #5fd98f;
  --green-100: #dff6e9;
  --warning: #8a5200;
  --warning-bg: #fff6e5;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #047a3e;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-card: 0 14px 36px rgba(6, 17, 31, 0.07);
  --font-display: "Outfit", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-950);
  background:
    radial-gradient(circle at top right, rgba(0, 166, 80, 0.1), transparent 32%),
    linear-gradient(180deg, #f5f8fb 0%, var(--surface-soft) 100%);
  min-height: 100vh;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  min-height: 72px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 17, 31, 0.94);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: #fff;
}

.brand-logo {
  width: auto;
  max-width: 148px;
  height: 36px;
  object-fit: contain;
}

.brand-fallback {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 166, 80, 0.16);
  color: var(--green-300);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.view.hidden {
  display: none;
}

.page-head {
  margin-bottom: 22px;
}

h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lede {
  margin: 0;
  color: var(--ink-600);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 62ch;
}

.card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 0 0 16px;
  box-shadow: var(--shadow-card);
}

.card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.meta {
  color: var(--ink-600);
  font-size: 0.9rem;
  margin: 0 0 14px;
  line-height: 1.45;
  word-break: break-word;
}

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

button,
.button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  background: var(--green-600);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--green-700);
  transform: translateY(-1px);
}

button:active:not(:disabled),
.button:active {
  transform: translateY(0);
}

button.ghost,
.button.ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

button.ghost:hover:not(:disabled),
.button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}

.card button.ghost,
.card .button.ghost,
#view-list button.ghost,
#view-detail button.ghost {
  color: var(--ink-800);
  border-color: var(--line-strong);
  background: var(--surface);
}

.card button.ghost:hover:not(:disabled),
#view-list button.ghost:hover:not(:disabled),
#view-detail button.ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--green-300);
  color: var(--green-800);
}

button.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c1bc;
}

button.danger:hover:not(:disabled) {
  background: #fee4e2;
  color: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--green-100);
  color: var(--success);
  white-space: nowrap;
}

.status.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.status.cancelled {
  background: var(--surface-soft);
  color: var(--ink-500);
}

.status.review {
  background: #e8f0ff;
  color: #1d4f91;
}

.application-card .card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 8px;
}

.application-card h2 {
  margin: 0;
  flex: 1 1 180px;
  min-width: 0;
}

.application-card .actions {
  margin-top: 4px;
}

.application-card .actions button {
  width: 100%;
}

.panel-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.panel-message.ok {
  background: var(--green-100);
  color: var(--success);
  border: 1px solid #b7e4cb;
}

.panel-message.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c1bc;
}

form.grid {
  display: grid;
  gap: 14px;
}

form.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-800);
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink-950);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(0, 166, 80, 0.14);
}

.doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.doc-row:last-child {
  border-bottom: 0;
}

.doc-row strong {
  display: block;
  word-break: break-word;
}

.doc-row input[type="file"] {
  width: 100%;
  max-width: 100%;
  padding: 8px;
  font-size: 0.82rem;
}

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

.ok {
  color: var(--success);
  font-weight: 700;
}

.empty-state {
  padding: 28px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty-state h1 {
  font-size: 1.35rem;
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 12px 16px;
    min-height: auto;
  }

  .brand {
    flex: 1 1 auto;
    flex-wrap: wrap;
  }

  .brand-tag {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .user-label {
    flex: 1 1 auto;
    max-width: none;
  }

  .shell {
    width: calc(100% - 24px);
    margin: 18px auto 40px;
  }

  .card {
    padding: 16px;
  }

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

  .doc-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .actions button,
  .actions .button {
    flex: 1 1 100%;
  }

  #view-detail .actions {
    flex-direction: column;
  }
}
