:root {
  --blue-900: #0b3d5c;
  --blue-700: #135a8a;
  --blue-500: #1e7bb8;
  --blue-100: #e6f2fa;
  --green: #1a8754;
  --red: #c0392b;
  --amber: #b8860b;
  --gray-50: #f7f9fb;
  --gray-100: #eef1f4;
  --gray-300: #d3dbe2;
  --gray-500: #7c8894;
  --gray-800: #2b3742;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--blue-900);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}

.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  letter-spacing: 0.2px;
}

.topbar nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar nav a {
  color: #dceaf5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.92rem;
}

.topbar nav a.active,
.topbar nav a:hover {
  background: rgba(255,255,255,0.14);
  color: white;
  text-decoration: none;
}

.lang-switch {
  display: flex;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  overflow: hidden;
  margin-left: 8px;
}
.lang-switch a {
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #dceaf5;
  letter-spacing: 0.03em;
}
.lang-switch a.active {
  background: white;
  color: var(--blue-900);
}
.lang-switch a:hover { text-decoration: none; }
.lang-switch a:not(.active):hover { background: rgba(255,255,255,0.14); color: white; }

.lang-switch.floating {
  position: fixed;
  top: 18px;
  right: 18px;
  border-color: rgba(255,255,255,0.5);
  background: rgba(11,61,92,0.35);
  z-index: 10;
}
.lang-switch.floating a { color: white; }

.topbar .user-chip {
  color: #dceaf5;
  font-size: 0.85rem;
  margin-right: 10px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

h1 { font-size: 1.6rem; margin: 0 0 6px; color: var(--blue-900); }
h2 { font-size: 1.2rem; margin: 28px 0 12px; color: var(--blue-900); }
.subtitle { color: var(--gray-500); margin-bottom: 24px; }

.card {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 18px;
}
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--blue-900); }
.stat .label { color: var(--gray-500); font-size: 0.88rem; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
th { color: var(--gray-500); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--gray-50); }

.btn {
  display: inline-block;
  background: var(--blue-700);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: var(--blue-500); text-decoration: none; }
.btn.secondary { background: white; color: var(--blue-700); border: 1px solid var(--blue-500); }
.btn.secondary:hover { background: var(--blue-100); }
.btn.danger { background: white; color: var(--red); border: 1px solid var(--red); }
.btn.danger:hover { background: #fbecea; }
.btn:disabled { background: var(--gray-300); color: var(--gray-500); cursor: not-allowed; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

form.inline { display: inline; }

label { display: block; font-size: 0.85rem; color: var(--gray-500); margin: 12px 0 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
}
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox] { width: auto; margin-right: 8px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.pending { background: #fdf2dc; color: var(--amber); }
.badge.approved { background: #e3f5ec; color: var(--green); }
.badge.rejected { background: #fbecea; color: var(--red); }
.badge.open { background: #fdf2dc; color: var(--amber); }
.badge.done { background: #e3f5ec; color: var(--green); }

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.flash.success { background: #e3f5ec; color: #14603c; }
.flash.error { background: #fbecea; color: #8a2417; }
.flash.info { background: var(--blue-100); color: var(--blue-900); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--blue-900), var(--blue-700));
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { text-align: center; }
.login-card .subtitle { text-align: center; }

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 12px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius) var(--radius) 0 0;
}
.pdf-toolbar .btn {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  font-size: 0.95rem;
}
.pdf-canvas-wrap {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-top: none;
  padding: 16px;
  display: flex;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border-radius: 0 0 var(--radius) var(--radius);
}
#pdf-canvas { box-shadow: 0 2px 10px rgba(0,0,0,0.15); background: white; max-width: 100%; height: auto; display: block; }

#pdf-viewer-container:fullscreen,
#pdf-viewer-container:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--gray-800);
}
#pdf-viewer-container:fullscreen .pdf-canvas-wrap,
#pdf-viewer-container:-webkit-full-screen .pdf-canvas-wrap {
  flex: 1;
  align-items: center;
  border-radius: 0;
  border: none;
}
#pdf-viewer-container:fullscreen .pdf-toolbar,
#pdf-viewer-container:-webkit-full-screen .pdf-toolbar {
  border-radius: 0;
}

.small-text { font-size: 0.85rem; color: var(--gray-500); }
.hint { background: var(--blue-100); color: var(--blue-900); padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 16px; }

.matrix-table td.done { color: var(--green); font-weight: 600; }
.matrix-table td.open { color: var(--red); font-weight: 600; }
