/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8f9fa; color: #1a1a2e; }
a { text-decoration: none; color: inherit; }

/* ── Layout helpers ── */
.page-center { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Login ── */
.login-card {
  margin: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 48px 40px;
  width: 360px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.login-sub { color: #64748b; margin-bottom: 32px; font-size: .95rem; }
.btn-github { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #1a1a2e; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }

/* ── Dashboard header ── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.dashboard-title { font-size: 1.1rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-email { font-size: .85rem; color: #64748b; }

/* ── Module cards ── */
.module-grid {
  display: flex;
  gap: 24px;
  padding: 48px 40px;
  justify-content: center;
  flex-wrap: wrap;
}
.module-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 36px 32px;
  width: 220px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.module-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.module-icon { font-size: 2.4rem; margin-bottom: 16px; }
.module-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.module-desc { font-size: .82rem; color: #64748b; line-height: 1.5; }

/* ── Sidebar layout (模組頁共用) ── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 24px 0;
  flex-shrink: 0;
}
.sidebar-logo { padding: 0 20px 24px; font-size: 1rem; font-weight: 700; color: #1a1a2e; }
.sidebar-nav a {
  display: block;
  padding: 10px 20px;
  font-size: .9rem;
  color: #374151;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: #f1f5f9;
  border-left-color: #6366f1;
  color: #6366f1;
}
.main-content { flex: 1; padding: 32px 36px; overflow-y: auto; }

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 1.3rem; font-weight: 700; }

/* ── Search & filter bar ── */
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.input-search {
  flex: 1; min-width: 200px;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
  outline: none;
}
.input-search:focus { border-color: #6366f1; }
.select-filter {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  outline: none;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 500;
}
.tag-network   { background: #dbeafe; color: #1d4ed8; }
.tag-hardware  { background: #fef9c3; color: #854d0e; }
.tag-software  { background: #dcfce7; color: #166534; }
.tag-server    { background: #ede9fe; color: #5b21b6; }
.tag-security  { background: #fee2e2; color: #991b1b; }
.tag-account   { background: #fce7f3; color: #9d174d; }
.tag-vendor    { background: #ffedd5; color: #9a3412; }
.tag-other     { background: #f1f5f9; color: #475569; }

/* ── Table ── */
.table-wrap { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-weight: 600; color: #475569; border-bottom: 1px solid #e2e8f0; }
td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.td-actions { display: flex; gap: 8px; }
.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: 6px; }
.btn-edit { background: #f1f5f9; color: #374151; border: none; cursor: pointer; }
.btn-del  { background: #fee2e2; color: #991b1b; border: none; cursor: pointer; }
.btn-edit:hover { background: #e2e8f0; }
.btn-del:hover  { background: #fecaca; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #6366f1;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
