:root {
  --header-height: 60px;
  --notice-height: 52px;
  --primary: #0067c0;
  --primary-dark: #00529b;
  --app-bg: #f3f4f6;
  --panel-soft: #f8f9fb;
  --header-bg: #111827;
  --header-link: #f9fafb;
  --panel-bg: #ffffff;
  --panel-border: #d8dee8;
  --text-main: #1d2939;
  --text-subtle: #667085;
  --line-soft: #e8ecf2;
}
* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--text-main);
  font-family: "Noto Sans JP", sans-serif;
  background: linear-gradient(180deg, #fbfbfc 0%, var(--app-bg) 100%);
}
button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--header-height);
  background: var(--header-bg);
  border-bottom-color: #111827 !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.app-navbar .app-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-inline: 28px;
}

.navbar-brand {
  margin: 0;
  color: var(--header-link);
  font-family: "Anton", sans-serif;
  letter-spacing: 0.05em;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
}

.storage-notice {
  position: sticky;
  top: var(--header-height);
  z-index: 1020;
  --trial-storage-notice-height: var(--notice-height);
}

.system-message {
  position: fixed;
  z-index: 2000;
  top: calc(var(--header-height) + var(--notice-height) + 70px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(620px, calc(100% - 28px));
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid #b8d3ee;
  border-radius: 10px;
  color: #18496f;
  background: #f0f8ff;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14);
  font-size: 0.86rem;
  font-weight: 700;
}

.system-message.is-error { border-color: #f2b8b5; color: #912018; background: #fff1f0; }
.system-message.is-success { border-color: #a6d9c8; color: #106b4d; background: #effbf6; }
.system-message button { margin-left: auto; border: 0; color: inherit; background: transparent; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: calc(100dvh - var(--header-height) - var(--notice-height));
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 14px 18px;
  border-right: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(242,246,252,.98));
}

.sidebar-add-button, .category-button, .category-action-button, .tool-button, .icon-button { border-radius: 8px; }

.sidebar-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(0,103,192,.55);
  border-radius: 10px;
  color: #005bab;
  background: rgba(0,103,192,.12);
  font-weight: 800;
}
.header-inner { display:flex; align-items:center; height:var(--header-height); padding:0 28px; }
.logo-area { display:inline-flex; align-items:center; gap:10px; }
.logo-text.attendance-brand.brand-v2 { padding:0 16px 0 0; color:#fff; font-family:"Yomogi","Noto Sans JP",sans-serif; font-size:34px; font-weight:400; font-synthesis:none; line-height:1; letter-spacing:.02em; text-shadow:0 1px 0 rgba(255,255,255,.2); }

.sidebar-add-button:hover, .sidebar-add-button:focus { color: #004f9e; background: rgba(0,103,192,.18); }

.category-nav { display: grid; gap: 5px; min-height: 0; overflow: auto; padding-right: 2px; }
.category-row { display: grid; grid-template-columns: minmax(0,1fr) 28px; gap: 2px; align-items: center; }

.category-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid transparent;
  color: #344054;
  text-align: left;
  background: transparent;
}

.category-button:hover, .category-button:focus { border-color: #c9d3e2; background: #fff; outline: none; }
.category-button.is-active { border-color: #9eb4ef; color: var(--primary-dark); background: #eef4ff; box-shadow: inset 3px 0 0 var(--primary); }
.category-button.is-drop-target { border-color: var(--primary); color: var(--primary-dark); background: #dcecff; box-shadow: inset 0 0 0 2px rgba(0,103,192,.2); }
.category-action-button { display: inline-grid; place-items: center; border: 1px solid transparent; color: #7a8493; background: transparent; }
.category-action-button { width: 28px; height: 30px; padding: 0; font-size: .72rem; }
.category-action-button:hover, .category-action-button:focus { border-color: #c9d3e2; color: var(--primary-dark); background: #eef4ff; outline: none; }
.category-action-button:disabled { color: #bcc3cd; background: transparent; }

.category-main { display: inline-flex; align-items: center; min-width: 0; gap: 9px; font-size: .86rem; font-weight: 800; }
.category-main i { width: 20px; color: var(--primary); text-align: center; }
.category-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 20px; padding: 0 7px; border-radius: 999px; color: #344054; background: #e9edf5; font-size: .72rem; font-weight: 900; }

.main-panel { min-width: 0; min-height: 0; overflow: auto; padding: 0 22px 24px; }
.board-toolbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; min-height: 62px; padding: 16px 0 8px; border-bottom: 1px solid var(--panel-border); background: rgba(248,249,251,.93); backdrop-filter: blur(10px); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view-switch { display:flex; gap:6px; margin-left:auto; }

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #c9d3e2;
  color: #344054;
  background: #fff;
  font-weight: 800;
}
.tool-button:hover, .tool-button:focus, .tool-button.is-active { border-color: #9eb4ef; color: var(--primary-dark); background: #eef4ff; }
.tool-button-primary { min-height: 41px; padding: 10px 14px; border-color: rgba(0,103,192,.55); color: #005bab; background: rgba(0,103,192,.12); }

.mobile-category-row { display: none; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-items: stretch; padding-top: 12px; }

.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: inherit;
  background: var(--panel-bg);
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.card-accent-blue { background:#eef6ff; }.card-accent-green { background:#eefaf4; }.card-accent-yellow { background:#fffbea; }.card-accent-orange { background:#fff3e8; }.card-accent-red { background:#fff0f3; }.card-accent-violet { background:#f5f0ff; }
.link-url-row { display:none; }
.link-grid.is-list-view { display:block; overflow-x:auto; }
.link-list-header { display:grid; grid-template-columns:minmax(160px,1.2fr) minmax(220px,2fr) minmax(170px,auto); gap:16px; min-width:680px; padding:9px 12px; border-bottom:1px solid var(--panel-border); color:var(--text-subtle); font-size:.76rem; font-weight:800; }
.link-grid.is-list-view .link-card { display:grid; grid-template-columns:minmax(160px,1.2fr) minmax(220px,2fr) minmax(170px,auto); gap:16px; align-items:center; min-width:680px; min-height:54px; padding:8px 12px; border-width:0 0 1px; border-radius:0; box-shadow:none; }
.link-grid.is-list-view .site-icon { display:none; }
.link-grid.is-list-view .card-topline { display:flex; gap:10px; align-items:center; min-width:0; padding:0; }
.link-grid.is-list-view .link-url-row { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--primary-dark); font-size:.82rem; }
.link-grid.is-list-view .card-actions { position:static; justify-content:flex-end; }
.link-grid.is-list-view .icon-button { display:inline-flex; gap:5px; width:auto; height:32px; padding:0 9px; border:1px solid #8ca4bd; border-radius:6px; font-size:.8rem; font-weight:700; }
.link-grid.is-list-view .icon-button[data-action="delete"] { border-color:#f05b68; color:#d92d3a; }
.action-label { display:none; }
.link-grid.is-list-view .action-label { display:inline; }
.inline-editor-row { display:grid; grid-template-columns:minmax(160px,1.2fr) minmax(220px,2fr) minmax(170px,auto); gap:16px; align-items:center; min-width:680px; padding:8px 12px; border-bottom:1px solid var(--panel-border); background:#f8fbff; }
.inline-editor-actions { display:flex; flex-wrap:nowrap; gap:6px; align-items:center; white-space:nowrap; }
.inline-editor-actions select { width:120px; }

.category-row[draggable="true"] { cursor:grab; }
.category-row.is-category-dragging { opacity:.55; }
.category-row.is-category-drag-over { box-shadow:0 -3px 0 var(--primary); }

.link-card:hover, .link-card:focus-within { border-color: #a8c7ee; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(22,32,51,.09); }
.link-card[draggable="true"] { cursor: grab; }
.link-card.is-dragging { opacity: .58; transform: scale(.985); }
.link-card.is-drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,103,192,.18); }

.card-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }
.list-actions { display:none; }
.link-grid.is-list-view .list-actions { display:flex; }
.card-menu { position:absolute; top:7px; right:6px; }
.menu-button { display:inline-grid; place-items:center; width:30px; height:30px; border:0; color:#7a8493; background:transparent; }
.menu-button:hover,.menu-button:focus { color:var(--primary-dark); background:#eef4ff; outline:none; }
.list-drag-handle { display:none; }
.link-grid.is-list-view .list-drag-handle { display:inline-block; margin-right:8px; color:#98a2b3; }
.link-grid:not(.is-list-view) .card-actions { display:none; }
.icon-button { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; color: #7a8493; background: transparent; }
.icon-button:hover, .icon-button:focus { color: var(--primary-dark); background: #eef4ff; outline: none; }
.card-topline { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; align-items: center; padding: 3px 64px 0 0; }
.card-topline.no-favicon { grid-template-columns:minmax(0,1fr); }
.site-favicon { width: 30px; height: 30px; object-fit: contain; border-radius: 6px; }
.card-title-group { min-width: 0; }
.card-title-group h3 { margin: 0; overflow: hidden; color: #1d2939; font-size: .94rem; font-weight: 900; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.card-title-link { color: inherit; text-decoration: none; }
.card-title-link:hover, .card-title-link:focus { color: var(--primary-dark); text-decoration: underline; outline: none; }

.empty-state { display: grid; place-items: center; gap: 10px; min-height: 210px; margin-top: 16px; border: 1px dashed #c9d3e2; border-radius: 8px; color: var(--text-subtle); background: #fff; }
.empty-state p { margin: 0; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: grid; gap: 5px; color: #344054; font-size: .86rem; font-weight: 800; }
.form-field small { color: var(--text-subtle); font-size: .72rem; font-weight: 500; }
.form-field-wide { grid-column: 1 / -1; }
.form-error { margin: 12px 0 0; color: #b42318; font-size: .86rem; font-weight: 800; }

.import-summary { display: grid; gap: 7px; padding: 12px; border-radius: 8px; background: #f6f8fb; }
.import-summary div { display: flex; justify-content: space-between; gap: 20px; }
.import-summary dt, .import-summary dd { margin: 0; }
.import-summary dd { font-weight: 900; }
.import-warning { margin: 14px 0 0; color: #8a5300; font-weight: 800; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns:clamp(180px,24vw,220px) minmax(0,1fr); }
  .sidebar { padding: 12px 9px; }
  .category-row { grid-template-columns:minmax(0,1fr) 28px; }
  .category-action-button { width:28px; }
  .category-button { justify-content:space-between; padding-inline:10px; }
  .count-badge { position:static; min-width:24px; height:20px; padding:0 7px; transform:none; font-size:.72rem; }
  .main-panel { padding-inline: 16px; }
}

@media (max-width: 680px) {
  :root { --notice-height: 0px; }
  .app-navbar .app-container { padding-inline: 14px; }
  .local-badge { font-size: .68rem; }
  .storage-notice { position:static; }
  .app-shell { display: block; height: auto; min-height: calc(100dvh - var(--header-height) - var(--notice-height)); overflow: visible; }
  .sidebar { display: none; }
  .main-panel { overflow: visible; padding: 0 14px 22px; }
  .board-toolbar { min-height: 52px; gap: 8px; }
  .toolbar-actions { width: 100%; gap: 7px; }
  .tool-button { flex: 1; min-width: 0; padding: 0 7px; font-size: .76rem; }
  .tool-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-category-row { display: grid; grid-template-columns: minmax(0,1fr) 34px; gap: 4px; align-items: center; padding-top: 12px; }
  .mobile-category-select { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid #c9d3e2; border-radius: 8px; color: var(--text-main); background: #fff; font-weight: 800; }
  .mobile-category-action { width: 34px; height: 34px; border: 1px solid #c9d3e2; }
  .link-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field-wide { grid-column: auto; }
  .system-message { top: calc(var(--header-height) + var(--notice-height) + 112px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
/* Issue #224: shared board appearance preferences */
:root { --sidebar-width: 248px; --sidebar-background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(242,246,252,.98)); }
:root[data-linkboard-theme="blue"] { --app-bg:#eff6ff; --panel-soft:#eff6ff; --panel-border:#bfdbfe; --line-soft:#dbeafe; --primary:#2563eb; --primary-dark:#1d4ed8; --sidebar-background:linear-gradient(180deg,#f8fbff,#e8f2ff); }
:root[data-linkboard-theme="green"] { --app-bg:#f0fdf4; --panel-soft:#f0fdf4; --panel-border:#bbf7d0; --line-soft:#dcfce7; --primary:#15803d; --primary-dark:#166534; --sidebar-background:linear-gradient(180deg,#f8fff9,#e8f8ee); }
:root[data-linkboard-theme="beige"] { --app-bg:#faf6ed; --panel-soft:#faf6ed; --panel-border:#e7d8bb; --line-soft:#f0e5d0; --primary:#9a5b13; --primary-dark:#7c4710; --sidebar-background:linear-gradient(180deg,#fffdf8,#f5ecdc); }
.sidebar { background:var(--sidebar-background); }
.sidebar-resizer { display:none; }
.is-resizing-sidebar { cursor:col-resize; user-select:none; }
@media (min-width:901px) {
  .app-shell { grid-template-columns:var(--sidebar-width) 10px minmax(0,1fr); }
  .sidebar { border-right:0; }
  .sidebar-resizer { position:relative; display:block; width:10px; height:100%; padding:0; border:0; border-right:1px solid var(--panel-border); border-left:1px solid transparent; background:transparent; cursor:col-resize; touch-action:none; }
  .sidebar-resizer::after { position:absolute; top:50%; left:50%; width:4px; height:42px; border-radius:999px; background:#a8b4c5; content:""; transform:translate(-50%,-50%); }
  .sidebar-resizer:hover,.sidebar-resizer:focus-visible,.sidebar-resizer.is-resizing { border-color:var(--primary); background:color-mix(in srgb,var(--primary) 12%,transparent); }
  .sidebar-resizer:hover::after,.sidebar-resizer:focus-visible::after,.sidebar-resizer.is-resizing::after { background:var(--primary); }
}

.import-selection-actions { display:flex; gap:8px; margin-bottom:12px; }
.import-link-list { display:grid; gap:8px; max-height:52vh; overflow:auto; }
.import-link-row { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px; align-items:center; padding:10px; border:1px solid var(--panel-border); border-radius:8px; }
.import-link-details { min-width:0; }
.import-link-details strong,.import-link-details small { display:block; overflow-wrap:anywhere; }
