:root {
  --bg: #12181f;
  --surface: #1b232d;
  --surface-2: #232e3a;
  --border: #2e3a48;
  --text: #e9edf1;
  --text-secondary: #8fa0b0;
  --accent: #f2a900;
  --accent-ink: #1a1200;
  --success: #4caf7d;
  --success-bg: #17301f;
  --warning: #f2a900;
  --warning-bg: #322608;
  --danger: #e5555a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

a { color: inherit; }

.hazard {
  height: 4px;
  background: repeating-linear-gradient(
    -45deg, var(--accent), var(--accent) 10px, #1a1200 10px, #1a1200 20px
  );
}

header.app-header {
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

header.app-header .brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

main {
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
}

main.full-width {
  max-width: 100% !important;
  width: 100%;
  margin: 0 !important;
  padding: 16px 0 0 !important;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.card-row:first-child { border-top: none; padding-top: 0; }

.label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge.pendiente { background: var(--surface-2); color: var(--text-secondary); }
.badge.en_curso { background: var(--warning-bg); color: var(--accent); }
.badge.cerrada { background: var(--success-bg); color: var(--success); }
.badge.vencida { background: rgba(229, 85, 90, 0.15); color: var(--danger); }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  min-height: 48px; /* objetivo táctil grande: uso en obra, con guantes */
}

.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-row .btn { flex: 1; }

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .btn {
  flex: none;
  width: auto;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 13px;
  min-height: 38px;
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--surface);
}

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
}

label.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field { margin-bottom: 14px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stat .n { font-size: 24px; font-weight: 800; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-secondary); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
td { padding: 8px 6px; border-bottom: 1px solid var(--border); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--danger); color: #fff; font-size: 13px; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box { width: 100%; max-width: 360px; }
