/* ==============================
   Reset & Base
   ============================== */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 14px;
  background: #f4f5f7;
  color: #1a1a1a;
  line-height: 1.5;
}

/* ==============================
   Login screen
   ============================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f5f7;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 10px;
  padding: 36px 32px 28px;
}

.login-title {
  margin: 0 0 2px;
  font-size: 22px;
  font-weight: 600;
  color: #111;
}

.login-subtitle {
  margin: 0 0 24px;
  font-size: 13px;
  color: #888;
}

/* ==============================
   App shell (sidebar + content)
   ============================== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==============================
   Sidebar
   ============================== */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e2e4e8;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #eee;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: #111;
}

.sidebar-company {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.nav-item:hover {
  background: #f0f1f3;
  color: #222;
}

.nav-item.active {
  background: #eef2ff;
  color: #3b5bdb;
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-email {
  font-size: 12px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.btn-logout {
  font-size: 12px;
  color: #999;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.btn-logout:hover {
  color: #c0392b;
  border-color: #e0a9a5;
}

/* ==============================
   Content area
   ============================== */
.content {
  flex: 1;
  overflow-y: auto;
  background: #f4f5f7;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.page-bar {
  background: #fff;
  border-bottom: 1px solid #e2e4e8;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #111;
}

.page-badge {
  font-size: 12px;
  color: #888;
  background: #f0f1f3;
  padding: 3px 10px;
  border-radius: 4px;
}

.page-body {
  padding: 24px 28px 40px;
  max-width: 800px;
}

/* ==============================
   Cards
   ============================== */
.card {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 14px;
  color: #111;
}

/* ==============================
   Form elements
   ============================== */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-weight: 500;
  font-size: 13px;
  color: #333;
}

.form-control {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: #3b5bdb;
  box-shadow: 0 0 0 2px rgba(59, 91, 219, 0.1);
}

.company-picker {
  position: relative;
}

.company-picker-input {
  width: 100%;
}

.company-picker-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.company-picker-item {
  padding: 9px 12px;
  font-size: 13px;
  color: #111;
  cursor: pointer;
}

.company-picker-item:hover,
.company-picker-item.active {
  background: #eef2ff;
}

.company-picker-empty {
  padding: 9px 12px;
  font-size: 13px;
  color: #888;
}

.form-hint {
  font-size: 12px;
  color: #888;
}

.form-error {
  font-size: 12px;
  color: #c0392b;
  min-height: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 4px;
}

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: #3b5bdb;
  color: #fff;
  border-color: #3b5bdb;
}

.btn-primary:hover {
  background: #364fc7;
  border-color: #364fc7;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==============================
   Result panel
   ============================== */
.result-panel {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  min-height: 100px;
  padding: 14px;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
  line-height: 1.6;
}

/* ==============================
   Utilities
   ============================== */
.hidden {
  display: none !important;
}

/* ==============================
   算定基礎届 (santei)
   ============================== */
.santei-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1px solid #f0e0b0;
  border-radius: 6px;
  font-size: 12px;
  color: #8a6d3b;
  line-height: 1.6;
}

.santei-card-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.santei-seq-field { width: 90px; }
.santei-name-field { width: 220px; }
.santei-kijun-field { width: 200px; }

.santei-card-head .santei-del {
  margin-left: auto;
}

.santei-table-wrap {
  overflow-x: auto;
}

.santei-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.santei-table th,
.santei-table td {
  border: 1px solid #e2e4e8;
  padding: 6px;
  text-align: center;
}

.santei-table th {
  background: #f4f5f7;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.santei-table td.santei-mlabel {
  background: #fafafa;
  font-weight: 600;
  white-space: nowrap;
  width: 56px;
}

.santei-table .form-control {
  width: 100%;
  text-align: right;
  padding: 6px 8px;
}

.santei-totals {
  margin-top: 14px;
}

/* 労働保険申告書: 列数が多い表は最小幅を確保して横スクロール */
.roudou-table {
  min-width: 640px;
}
.roudou-table td.roudou-na {
  color: #aaa;
  background: #fafafa;
}
.roudou-table .form-control {
  min-width: 72px;
}

.santei-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.santei-actions-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.santei-btn-ghost {
  background: #fff;
  color: #3b5bdb;
  border-color: #d1d5db;
}

.santei-btn-ghost:hover {
  border-color: #3b5bdb;
}

/* ==============================
   決算審査: タスク一覧の進捗表示
   ============================== */
.audit-jobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audit-refresh-btn {
  padding: 5px 14px;
  font-size: 12px;
  background: #fff;
  color: #3b5bdb;
  border-color: #d1d5db;
}

.audit-refresh-btn:hover {
  border-color: #3b5bdb;
}

.audit-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audit-progress-text {
  display: block;
  font-size: 12px;
  color: #555;
  margin-top: 2px;
}

.audit-progress-bar {
  margin-top: 4px;
  height: 4px;
  width: 100%;
  max-width: 180px;
  background: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.audit-progress-bar > span {
  display: block;
  height: 100%;
  background: #3b5bdb;
  transition: width 0.3s;
}

.audit-stale {
  display: block;
  font-size: 12px;
  color: #e8590c;
  margin-top: 2px;
}

.audit-field-hint {
  margin-left: 8px;
  font-weight: 400;
  font-size: 11px;
  color: #3b5bdb;
}
