/* public/assets/css/app.css */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e3e8ee;
  --primary: #1e3a5f;
  --primary-hover: #2b4f7d;
  --accent: #c9a227;
  --text: #1f2933;
  --muted: #6b7785;
  --success: #1f8a4c;
  --warning: #c98a00;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* ---------- Login ---------- */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #1e3a5f 0%, #16293f 100%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { font-size: 20px; margin: 12px 0 4px; }
.brand-mark {
  width: 44px; height: 44px; margin: 0 auto;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  border-radius: 10px; font-weight: 700; font-size: 20px;
}

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex: 0 0 240px;
  background: var(--primary);
  color: #dbe4ee;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-weight: 600; color: #fff;
}
.sidebar-brand .brand-mark { width: 32px; height: 32px; font-size: 15px; background: var(--accent); color: #1f2933; }
.sidebar-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: block; padding: 10px 12px; margin-bottom: 2px;
  color: #dbe4ee; text-decoration: none; border-radius: 8px; font-size: 14px;
}
.nav-item:hover { background: var(--primary-hover); color: #fff; }
.nav-section {
  padding: 16px 12px 6px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  color: #8fa6bf;
}
.sidebar-footer {
  padding: 14px 18px; font-size: 11px;
  color: #8fa6bf; border-top: 1px solid rgba(255, 255, 255, .1);
}

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 17px; margin: 0; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--muted); }

.content { padding: 24px; flex: 1; }
.app-footer {
  padding: 14px 24px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border); background: var(--surface);
}

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: .15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #f0f3f7; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .12);
}

.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-danger { background: #fdecea; color: #8e2a20; border: 1px solid #f5c6c0; }
.alert-success { background: #e8f6ee; color: #14663a; border: 1px solid #bfe3cd; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.mt-2 { margin-top: 16px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.link-center { text-align: center; font-size: 12px; color: var(--muted); text-decoration: none; }
.inline-form { display: inline; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }

/* ---------- Arquivos ---------- */
.grid-files { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.folder-tree h4 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 0; }
.tree ul { padding-left: 14px; border-left: 1px solid var(--border); margin-left: 4px; }
.tree li { margin: 2px 0; }
.tree a {
  display: block; padding: 7px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 13px;
}
.tree a:hover { background: #eef2f7; color: var(--primary); }

/* ---------- DataTables ---------- */
table.dataTable thead th {
  background: #f7f9fb; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border) !important;
}
table.dataTable tbody td { font-size: 13px; border-bottom: 1px solid #f0f3f7; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important; color: #fff !important;
  border-color: var(--primary) !important; border-radius: 6px;
}

/* ---------- Modais ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5);
  display: none; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close {
  background: none; border: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted);
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

.totp-box { background: #f7f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.secret { display: block; padding: 8px; background: #fff; border: 1px dashed var(--border); border-radius: 6px; font-size: 13px; word-break: break-all; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters select, .filters input {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit;
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .grid-files { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}