:root {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #101828;
  background-color: #f5f7fb;
  line-height: 1.6;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-border: #e4e7ec;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-muted: #475467;
  --color-success: #15803d;
  --color-danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-muted);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

.page {
  min-height: 100vh;
  padding: 2rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.card {
  background: var(--color-surface);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  margin: 0 auto 2rem;
  max-width: 960px;
}

.card--narrow {
  max-width: 420px;
}

.card--wide {
  grid-column: 1 / -1;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form label {
  font-weight: 600;
  color: #0f172a;
}

.form input,
.form textarea,
.form select,
.form button,
.btn {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  font-size: 1rem;
  font-family: inherit;
}

.form textarea {
  resize: vertical;
  min-height: 120px;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.form button,
.btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease-in-out, box-shadow 0.2s;
}

.btn--secondary {
  background: #1f2937;
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn--danger {
  background: var(--color-danger);
}

.btn:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.form__message {
  min-height: 1.5rem;
  color: var(--color-danger);
  margin: 0;
}

.form__message--success {
  color: var(--color-success);
}

.results {
  margin-top: 2rem;
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tag,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.badge--muted {
  background: #f2f4f7;
  color: var(--color-muted);
}

.badge--success {
  background: #dcfce7;
  color: #15803d;
}

.badge--danger {
  background: #fee2e2;
  color: #b91c1c;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  font-weight: 600;
  color: #0f172a;
  background: #f9fafb;
}

.table th,
.table td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
  vertical-align: middle;
}

.table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.table-wrapper {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface);
}

.footer {
  text-align: center;
  padding: 1rem;
  color: var(--color-muted);
}

.footer p {
  margin: 0.15rem 0;
}

.footer--muted {
  font-size: 0.9rem;
}

.footer--dashboard {
  margin-top: auto;
}

.page--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  gap: 1rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--color-bg);
}

.sidebar {
  background: #0f172a;
  color: #fff;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar__brand h2 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}

.sidebar__brand span {
  color: #94a3b8;
  font-size: 0.9rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar__link {
  border: none;
  background: transparent;
  color: inherit;
  text-align: right;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar__link-icon {
  width: 1.5rem;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar__link-text {
  flex: 1;
}

.sidebar__link:hover,
.sidebar__link.is-active {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.topbar h1 {
  margin: 0 0 0.25rem;
  color: #0f172a;
}

.topbar__actions {
  display: flex;
  gap: 0.75rem;
}

.section {
  background: var(--color-surface);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.06);
  display: none;
}

.section--active {
  display: block;
}

.section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filters-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  margin: 1rem 0;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

.filters-card__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 200px;
}

.filters-card__field label {
  font-weight: 600;
  color: #0f172a;
}

.filters-card__field--grow {
  flex: 1;
  min-width: 260px;
}

.search-input {
  min-width: 240px;
}

.drawer {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  background: #f9fafb;
}

.drawer[hidden] {
  display: none;
}

.drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.drawer li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.35rem;
  background: var(--color-success);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.files-list {
  display: grid;
  gap: 1rem;
}

.files-card {
  border: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal--open {
  display: flex;
}

.modal__dialog {
  background: var(--color-surface);
  border-radius: 1rem;
  width: min(520px, 95vw);
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal__footer {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1100;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 0.85rem;
  min-width: 220px;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.2);
}

.toast--success {
  background: #15803d;
}

.toast--danger {
  background: #dc2626;
}

.alert {
  border-radius: 0.75rem;
  padding: 1rem;
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    overflow-x: auto;
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1rem;
  }

  .topbar,
  .section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section__actions,
  .topbar__actions {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }
}
