/* ============================================================
   AMX Ehitus — учёт часов. Минимальный, mobile-first CSS.
   ============================================================ */

:root {
  --bg: #eef1f6;
  --bg-grad-1: #eaeef5;
  --bg-grad-2: #f3f5f9;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.9);
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1f6feb;
  --primary-hover: #1859c4;
  --success-bg: #e6f4ea;
  --success-text: #0f5132;
  --error-bg: #fdecea;
  --error-text: #8a1f1f;
  --danger: #c53030;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.05);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(at 20% 0%, rgba(31,111,235,0.07), transparent 50%),
    radial-gradient(at 90% 100%, rgba(99,102,241,0.07), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-bottom: 1px solid rgba(229, 231, 235, 0.6);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.nav {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.nav a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { background: #f1f3f5; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.lang-switch a.active { background: var(--primary); color: #fff; }
.user-name { color: var(--muted); }
.logout-link { color: var(--muted); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* ===== Container ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== Card ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h1 { font-size: 22px; margin: 0 0 12px; }
.card h2 { font-size: 18px; margin: 0 0 12px; }
.card hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.login-card {
  max-width: 420px;
  margin: 40px auto;
}

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field-full { grid-column: 1 / -1; }
.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
input[type=text], input[type=email], input[type=date], input[type=time],
select, textarea {
  font: inherit;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}
textarea { resize: vertical; min-height: 60px; }

button, .btn-primary, .btn-secondary, .btn-small, .btn-danger {
  font: inherit;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary, button[type=submit] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: #f1f3f5; }
.btn-small {
  padding: 4px 10px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-small:hover { background: #f1f3f5; }
.btn-small.btn-danger {
  padding: 4px 10px;
  font-size: 13px;
  background: #fff;
  color: var(--danger);
  border-color: rgba(197, 48, 48, 0.4);
}
.btn-small.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.actions { display: flex; gap: 8px; }
form.inline { display: inline-flex; gap: 4px; align-items: center; }
form.inline input[type=text] { width: auto; min-width: 0; }

/* ===== Net hours preview ===== */
.net-hours-field .net-hours-display {
  font-size: 22px;
  font-weight: 700;
  padding: 6px 0;
  color: var(--primary);
}

/* ===== Filters ===== */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  font-weight: 600;
  background: rgba(248, 250, 252, 0.7);
  color: var(--muted);
  white-space: nowrap;
}
table.data tr:hover td { background: rgba(248, 250, 252, 0.5); }
table.data.summary { width: 100%; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.summary-grid h3 {
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.archived-row { opacity: 0.5; }
.totals { font-size: 16px; margin-bottom: 8px; }

/* ===== Flash ===== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error   { background: var(--error-bg);   color: var(--error-text); }

/* ===== Misc ===== */
.muted { color: var(--muted); font-size: 13px; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
  .topbar-inner { gap: 8px; }
  .nav { order: 3; width: 100%; }
  .card { padding: 16px; }
  .card h1 { font-size: 20px; }
  table.data { font-size: 13px; }
  table.data th, table.data td { padding: 6px 8px; }
}
