:root {
  --navy: #1a2245;
  --navy-light: #242e57;
  --navy-lighter: #323d6b;
  --accent: #2f6fed;
  --accent-hover: #2258c9;
  --accent-light: #eaf1ff;
  --bg: #f3f5fb;
  --card: #ffffff;
  --text: #1f2430;
  --text-muted: #6b7280;
  --border: #e6e9f2;
  --success: #16a34a;
  --success-bg: #e9f9ee;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout shell ---------- */

#shell { display: contents; }

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  padding: 0 8px 8px;
}
.sidebar .logo .mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6ea8fe, #7c6bf2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.sidebar .tagline {
  font-size: 12px;
  color: #a9b2d6;
  padding: 0 8px 20px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cdd4ee;
  font-size: 14px;
  font-weight: 500;
}
.sidebar nav a:hover { background: var(--navy-lighter); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar nav a .icon { width: 18px; text-align: center; }

.sidebar .user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 4px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 10px;
  font-size: 13px;
  color: #cdd4ee;
}
.sidebar .user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #4b5694; display:flex; align-items:center; justify-content:center;
  font-size: 12px;
}
.sidebar .footer-note {
  font-size: 11px;
  color: #7a84ad;
  padding: 6px 8px 0;
}

.content {
  flex: 1;
  padding: 28px 32px 80px;
  max-width: 1080px;
}

.topbar-mobile {
  display: none;
}

.bottom-nav {
  display: none;
}

/* ---------- Page header ---------- */

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 20px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 {
  font-size: 16px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { background: #f7f8fc; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled, .btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #f3caca; }
.btn-danger:hover { background: #fdf1f1; }

/* ---------- Upload widget ---------- */

.upload-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.upload-choices button {
  flex-direction: column;
  padding: 14px 8px;
  font-size: 13px;
  gap: 6px;
}
.upload-choices .ic { font-size: 18px; }

.dropzone {
  border: 2px dashed #c7d3f7;
  border-radius: var(--radius);
  background: #fafbff;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.dropzone.dragover {
  background: var(--accent-light);
  border-color: var(--accent);
}
.dropzone .cloud { font-size: 34px; margin-bottom: 10px; }
.dropzone .hint { font-size: 12px; margin-top: 10px; color: #9aa2bd; }

.upload-progress {
  margin-top: 16px;
  display: none;
}
.upload-progress.active { display: block; }
.progress-bar-track {
  background: #e9ecf7;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---------- Table ---------- */

table.meetings {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.meetings th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table.meetings td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.meetings tr.clickable { cursor: pointer; }
table.meetings tr.clickable:hover { background: #fafbff; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.completed { background: var(--success-bg); color: var(--success); }
.status-badge.processing { background: var(--accent-light); color: var(--accent); }
.status-badge.error { background: #fdecec; color: var(--danger); }

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f2f3f8;
  color: var(--text-muted);
  margin-right: 4px;
}
.link-badge.ok { background: var(--success-bg); color: var(--success); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 10px;
  font-size: 14px;
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field .help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.field input:focus { outline: 2px solid var(--accent-light); border-color: var(--accent); }

.integration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.integration-row:last-child { border-bottom: none; }
.integration-row .info { display: flex; align-items: center; gap: 14px; }
.integration-row .icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--accent-light); color: var(--accent);
}
.integration-row .name { font-weight: 600; font-size: 14px; }
.integration-row .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Meeting detail ---------- */

.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; }
.task-item .task-text.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.minutes-body { font-size: 14px; line-height: 1.8; }
.minutes-body h1, .minutes-body h2, .minutes-body h3 { margin-top: 18px; margin-bottom: 8px; }
.minutes-body ul { padding-left: 20px; }

.transcript-box {
  max-height: 260px;
  overflow-y: auto;
  background: #fafbff;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.7;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}
.toast.show { opacity: 1; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar { display: none; }

  .topbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    color: #fff;
    padding: 14px 18px;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .topbar-mobile .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; }
  .topbar-mobile .mark {
    width: 26px; height: 26px; border-radius: 8px;
    background: linear-gradient(135deg, #6ea8fe, #7c6bf2);
    display: flex; align-items: center; justify-content: center; font-size: 14px;
  }
  .topbar-mobile .menu-btn { background: none; border: none; color: #fff; font-size: 20px; padding: 4px 8px; }

  .content {
    padding: 18px 16px 90px;
    max-width: 100%;
  }

  .upload-choices { grid-template-columns: repeat(2, 1fr); }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    font-size: 11px;
    color: var(--text-muted);
    border-radius: 10px;
  }
  .bottom-nav a .icon { font-size: 18px; }
  .bottom-nav a.active { color: var(--accent); }

  .drawer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 30;
    display: none;
  }
  .drawer.open { display: block; }
  .drawer .panel {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    background: var(--navy);
    padding: 20px 16px;
  }
  .drawer nav { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; }
  .drawer nav a {
    color: #cdd4ee; padding: 11px 12px; border-radius: 10px; font-size: 14px; font-weight: 500;
  }
  .drawer nav a.active { background: var(--accent); color: #fff; }
  .drawer .close-btn { color: #fff; background: none; border: none; font-size: 20px; float: right; }
}

@media (max-width: 520px) {
  .upload-choices { grid-template-columns: repeat(2, 1fr); }
  table.meetings { font-size: 12px; }
  table.meetings th:nth-child(4), table.meetings td:nth-child(4) { display: none; }
}
