
:root {
  --ink: #1c1b22;
  --ink-deep: #15141a;
  --surface: #26242e;
  --surface-2: #302e3a;
  --surface-3: #3a3745;
  --ivory: #f2ecdd;
  --ivory-dim: #a9a3ac;
  --ivory-faint: #736f7c;
  --brass: #c9a227;
  --brass-soft: #e4c65a;
  --wine: #b1495a;
  --sage: #7fae82;
  --amber: #d9a441;
  --line: rgba(242, 236, 221, 0.12);
  --line-soft: rgba(242, 236, 221, 0.07);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 15px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  background-image:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(201, 162, 39, 0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(177, 73, 90, 0.08), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ivory);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brass-soft); }

.dc-app {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent 220px);
  box-shadow: var(--shadow-2);
}
.dc-app::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--brass), var(--wine));
}
@media (min-width: 900px) {
  body { padding: 28px 16px; }
  .dc-app { min-height: calc(100vh - 56px); border-radius: var(--radius-lg); overflow: hidden; }
}

button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ------------------------------------------------------------ */
/* Cabeçalho e navegação                                         */
/* ------------------------------------------------------------ */

.dc-header { padding: 26px 24px 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dc-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brass-soft); margin: 0 0 6px;
}
.dc-title { font-family: var(--font-display); font-weight: 600; font-size: 28px; margin: 0 0 3px; letter-spacing: 0.002em; }
.dc-subtitle { font-size: 13px; color: var(--ivory-dim); margin: 0; font-style: italic; }
.dc-user { font-size: 12px; color: var(--ivory-dim); text-align: right; line-height: 1.6; }
.dc-user a { color: var(--ivory-dim); text-decoration: underline; text-underline-offset: 2px; }
.dc-user a:hover { color: var(--brass-soft); }

.dc-tabs {
  display: flex; gap: 2px; padding: 0 16px; overflow-x: auto; overflow-y: hidden;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 7px);
  background-size: 100% 30px; background-repeat: no-repeat; background-position: bottom;
  scrollbar-width: thin;
}
.dc-tab {
  display: flex; align-items: center; gap: 7px; text-decoration: none;
  color: var(--ivory-dim); padding: 11px 12px 13px; font-size: 13.5px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color 0.15s ease;
}
.dc-tab svg { opacity: 0.75; transition: opacity 0.15s ease; flex-shrink: 0; }
.dc-tab:hover { color: var(--ivory); }
.dc-tab:hover svg { opacity: 1; }
.dc-tab-active { color: var(--ivory); border-bottom-color: var(--brass); }
.dc-tab-active svg { opacity: 1; color: var(--brass-soft); }

.dc-panel { padding: 20px 22px 44px; }
.dc-panel-hint { font-size: 12.5px; color: var(--ivory-dim); margin: 0 0 12px; line-height: 1.5; }

/* ------------------------------------------------------------ */
/* Toolbars, campos e botões                                     */
/* ------------------------------------------------------------ */

.dc-toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.dc-freq-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 6px; }

.dc-search {
  display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 11px; flex: 1; min-width: 150px; transition: border-color 0.15s ease;
}
.dc-search:focus-within { border-color: var(--brass); }
.dc-search input { background: none; border: none; color: var(--ivory); font-size: 13.5px; outline: none; width: 100%; }
.dc-search input::placeholder { color: var(--ivory-faint); }

.dc-input {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ivory); font-size: 13.5px; padding: 8px 11px; transition: border-color 0.15s ease;
}
.dc-input:focus-visible { border-color: var(--brass); }
select.dc-input {
  min-width: 140px; padding-right: 30px; cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7' fill='none'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%23a9a3ac' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
textarea.dc-input { width: 100%; resize: vertical; line-height: 1.5; }

.dc-btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; padding: 8px 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.dc-btn:active { transform: translateY(1px); }
.dc-btn-primary { background: var(--brass); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.dc-btn-primary:hover { background: var(--brass-soft); }
.dc-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.dc-btn-ghost { background: transparent; border-color: var(--line); color: var(--ivory); }
.dc-btn-ghost:hover { background: var(--surface); border-color: var(--ivory-faint); }
.dc-btn-danger { background: var(--wine); color: var(--ivory); }
.dc-btn-danger:hover { background: #c25567; }
.dc-btn-sm { padding: 5px 10px; font-size: 12.5px; }

.dc-icon-btn {
  background: none; border: 1px solid transparent; color: var(--ivory-dim); cursor: pointer;
  padding: 7px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 5px;
  text-decoration: none; font-size: 12.5px; transition: background-color 0.15s ease, color 0.15s ease;
}
.dc-icon-btn:hover { background: var(--surface); color: var(--ivory); }
.dc-icon-btn-disabled { opacity: 0.3; cursor: not-allowed; }
.dc-icon-btn-disabled:hover { background: none; color: var(--ivory-dim); }

.dc-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 52px 20px; color: var(--ivory-dim); text-align: center;
}
.dc-empty svg { color: var(--ivory-faint); }
.dc-empty p { margin: 0; font-size: 14px; max-width: 340px; line-height: 1.55; }

/* ------------------------------------------------------------ */
/* Listas e linhas (turmas, alunos, frequência)                  */
/* ------------------------------------------------------------ */

.dc-list { display: flex; flex-direction: column; gap: 7px; }
.dc-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  padding: 12px 14px; box-shadow: var(--shadow-1); transition: border-color 0.15s ease;
}
.dc-row:hover { border-color: var(--line); }
.dc-row-inativo { opacity: 0.5; }
.dc-row-main { display: flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 0; flex-wrap: wrap; }
.dc-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: 0.001em; }
.dc-tag { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--ivory-dim); white-space: nowrap; }
.dc-tag-muted { color: var(--wine); }
.dc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ivory-dim); font-size: 12.5px; align-items: center; }
.dc-meta-item { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); }
.dc-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* ------------------------------------------------------------ */
/* Formulários                                                    */
/* ------------------------------------------------------------ */

.dc-form { max-width: 480px; }
.dc-form-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0 0 18px; }
.dc-field { margin-bottom: 14px; }
.dc-field label { display: block; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ivory-dim); margin-bottom: 6px; }
.dc-field-row { display: flex; gap: 12px; }
.dc-field-row .dc-field { flex: 1; }
.dc-field .errorlist { color: var(--wine); font-size: 12px; margin: 5px 0 0; padding: 0; list-style: none; }
.dc-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ivory); margin-top: 4px; }
.dc-checkbox-row input[type="checkbox"] { accent-color: var(--brass); width: 16px; height: 16px; }
.dc-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dc-inline-warning { font-size: 12.5px; color: var(--amber); margin: 4px 0 0; }

/* seletor de turmas: uma linha por turma, com checkbox + data de início específica opcional */
.dc-matricula-list { display: flex; flex-direction: column; gap: 6px; }
.dc-matricula-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dc-matricula-row:has(input[type="checkbox"]:checked) { border-color: var(--brass); background: var(--surface-3); }
.dc-matricula-check { display: flex; align-items: center; gap: 9px; cursor: pointer; flex: 1 1 200px; min-width: 0; font-size: 13.5px; color: var(--ivory); }
.dc-matricula-check input[type="checkbox"] { accent-color: var(--brass); width: 16px; height: 16px; flex-shrink: 0; }
.dc-matricula-data { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.dc-matricula-data-label { font-size: 10px; color: var(--ivory-faint); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.dc-input-sm { padding: 5px 8px; font-size: 12px; width: 138px; }

/* ------------------------------------------------------------ */
/* Frequência                                                     */
/* ------------------------------------------------------------ */

.dc-date-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dc-date-label { font-family: var(--font-display); font-size: 16px; margin: 12px 0 16px; color: var(--brass-soft); }
.dc-warning-inline { color: var(--amber); font-style: italic; }
.dc-summary-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.dc-summary-chip { font-size: 12px; padding: 5px 11px; border-radius: 20px; background: var(--surface-2); font-family: var(--font-mono); border: 1px solid var(--line-soft); }
.dc-summary-chip-muted { color: var(--ivory-dim); }
.dc-marcar-todos { margin-left: auto; }

.dc-status-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line);
  background: transparent; color: transparent; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 15px; transition: all 0.15s ease;
}
.dc-status-vazio:hover { border-color: var(--ivory-dim); background: var(--surface); }
.dc-status-presente { background: var(--sage); border-color: var(--sage); color: var(--ink); }
.dc-status-falta { background: var(--wine); border-color: var(--wine); color: var(--ivory); }
.dc-status-text { font-size: 12.5px; color: var(--ivory-dim); font-family: var(--font-mono); }
.dc-status-text-presente { color: var(--sage); }
.dc-status-text-falta { color: var(--wine); }
.dc-just-btn {
  background: none; border: 1px solid var(--line); color: var(--ivory-dim); border-radius: 20px;
  font-size: 11px; padding: 4px 9px; cursor: pointer; transition: all 0.15s ease;
}
.dc-just-btn:hover { border-color: var(--ivory-faint); }
.dc-just-btn-on { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ */
/* Relatório                                                      */
/* ------------------------------------------------------------ */

.dc-report-row { align-items: center; }
.dc-report-bar-wrap { display: flex; align-items: center; gap: 8px; flex: 1 1 160px; min-width: 120px; }
.dc-bar-track { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.dc-bar-fill { height: 100%; border-radius: 4px; background: var(--ivory-dim); }
.dc-bar-alta { background: var(--sage); }
.dc-bar-media { background: var(--amber); }
.dc-bar-baixa { background: var(--wine); }
.dc-pct { font-family: var(--font-mono); font-size: 13px; width: 42px; text-align: right; }
.dc-report-detail { flex: 0 0 auto; }
.dc-pct-explainer { margin: -6px 0 16px; font-size: 12px; }

.dc-grade-title {
  font-family: var(--font-display); font-weight: 600; font-size: 15.5px;
  margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px;
}
.dc-grade-title:first-of-type { margin-top: 4px; }

.dc-grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 12px; max-height: 70vh; }
.dc-grid-table { border-collapse: collapse; width: 100%; }
.dc-grid-table th, .dc-grid-table td { padding: 7px 9px; text-align: center; white-space: nowrap; }
.dc-grid-table thead th {
  font-family: var(--font-mono); font-size: 11px; color: var(--ivory-dim); font-weight: 500;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
.dc-grid-table tbody td { border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.dc-grid-table tbody tr:last-child td { border-bottom: none; }
.dc-grid-sticky {
  position: sticky; left: 0; text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 13.5px;
  background: var(--surface); z-index: 1; padding-left: 13px;
}
thead .dc-grid-sticky { background: var(--surface-2); z-index: 3; font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.04em; }
.dc-pct-cell { font-family: var(--font-mono); font-size: 12.5px; color: var(--brass-soft); font-weight: 600; }

.dc-cellwrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.dc-cell {
  width: 27px; height: 27px; border-radius: 7px; border: 1px solid var(--line);
  background: transparent; color: transparent; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.dc-cell-presente { background: var(--sage); border-color: var(--sage); color: var(--ink); }
.dc-cell-falta { background: var(--wine); border-color: var(--wine); color: var(--ivory); }
.dc-cell-justificada { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.dc-cell-na { opacity: 0.15; cursor: default; }
.dc-cell-vazio:hover { border-color: var(--ivory-dim); background: var(--surface-2); }
.dc-just-mark {
  position: absolute; top: -6px; right: -6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: 2px solid var(--ink); font-size: 8px; line-height: 10px;
  color: var(--ink); font-weight: 700; text-align: center; cursor: pointer; padding: 0;
}

.dc-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--ivory-dim); margin: 6px 0 0; }
.dc-legend-item { display: flex; align-items: center; gap: 6px; }
.dc-legend-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); }

/* ------------------------------------------------------------ */
/* Mensagens, backup, login                                       */
/* ------------------------------------------------------------ */

.dc-messages { list-style: none; margin: 0 0 16px; padding: 0; }
.dc-messages li { background: var(--surface-2); border-left: 3px solid var(--sage); padding: 9px 13px; border-radius: 6px; font-size: 13px; margin-bottom: 6px; }
.dc-messages li.error { border-left-color: var(--wine); }

.dc-backup { margin-bottom: 10px; }
.dc-backup-buttons { display: flex; justify-content: center; align-items: center; gap: 10px; }
.dc-backup-sep { color: var(--ivory-dim); font-size: 11px; }
.dc-backup-panel { margin-top: 10px; text-align: left; max-width: 480px; margin-left: auto; margin-right: auto; }
.dc-backup-textarea { width: 100%; height: 110px; font-family: var(--font-mono); font-size: 11px; }

.dc-footer { padding: 16px 20px 22px; text-align: center; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.dc-footer button, .dc-footer a { background: none; border: none; color: var(--ivory-faint); font-size: 11.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.dc-footer button:hover, .dc-footer a:hover { color: var(--ivory-dim); }

.dc-login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background-image:
    radial-gradient(ellipse 700px 500px at 50% 0%, rgba(201, 162, 39, 0.10), transparent 60%),
    repeating-linear-gradient(to bottom, var(--line-soft) 0, var(--line-soft) 1px, transparent 1px, transparent 8px);
  background-repeat: no-repeat, repeat;
}
.dc-login-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px; width: 100%; max-width: 350px; box-shadow: var(--shadow-2);
}
.dc-login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, var(--brass), var(--wine));
}

/* ------------------------------------------------------------ */
/* Responsivo                                                     */
/* ------------------------------------------------------------ */

@media (max-width: 560px) {
  .dc-header { padding: 20px 18px 14px; }
  .dc-title { font-size: 23px; }
  .dc-panel { padding: 16px 14px 36px; }
  .dc-field-row { flex-direction: column; gap: 14px; }
  .dc-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .dc-row-main { flex: 1 1 100%; }
  .dc-marcar-todos { margin-left: 0; width: 100%; }
  .dc-form { max-width: 100%; }
}
