/* ========== リセット・基本 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: #F5F6F8;
    color: #1A1A1A;
    font-size: 15px;
    line-height: 1.6;
}
a { color: #378ADD; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== レイアウト ========== */
.container { max-width: 480px; margin: 0 auto; padding: 1rem; }
.container-wide { max-width: 900px; margin: 0 auto; padding: 1rem; }

/* ========== ヘッダー ========== */
.app-header {
    background: #fff;
    border-bottom: 0.5px solid #E0E0E0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header .logo { font-size: 16px; font-weight: 600; color: #1F4E79; }
.app-header .logo span { color: #1D9E75; }
.app-header .user-info { font-size: 12px; color: #888; display: flex; align-items: center; gap: 12px; }

/* ========== カード ========== */
.card {
    background: #fff;
    border: 0.5px solid #E0E0E0;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 12px;
}
.card-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    font-weight: 500;
}

/* ========== バッジ ========== */
.badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
}
.badge-idle    { background: #F0F0F0; color: #888; }
.badge-flying  { background: #EAF3DE; color: #27500A; }
.badge-done    { background: #E6F1FB; color: #0C447C; }
.badge-purpose { background: #E6F1FB; color: #0C447C; }

/* ========== タイマー ========== */
.timer-block { text-align: center; padding: 1rem 0; }
.timer-display {
    font-size: 56px;
    font-weight: 500;
    color: #1A1A1A;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}
.timer-sub { font-size: 12px; color: #AAA; margin-top: 4px; }

/* ========== ボタン ========== */
.btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    display: block;
    text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-start  { background: #1D9E75; color: #fff; }
.btn-stop   { background: #E24B4A; color: #fff; }
.btn-save   { background: #378ADD; color: #fff; }
.btn-reset  { background: #F0F0F0; color: #666; border: 0.5px solid #E0E0E0; }
.btn-logout { background: transparent; color: #888; border: 0.5px solid #E0E0E0; font-size: 12px; padding: 6px 14px; border-radius: 6px; cursor: pointer; }
.btn + .btn { margin-top: 8px; }

/* ========== フォーム ========== */
.field-row { margin-bottom: 14px; }
.field-row:last-child { margin-bottom: 0; }
.field-label { font-size: 12px; color: #666; margin-bottom: 5px; display: block; }
.field-label .required { color: #E24B4A; margin-left: 3px; }
.field-input, .field-select, .field-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 0.5px solid #E0E0E0;
    border-radius: 8px;
    background: #fff;
    color: #1A1A1A;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
    outline: none;
    border-color: #378ADD;
}
.field-textarea { min-height: 80px; resize: vertical; }

/* ========== 位置情報 ========== */
.location-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid #F0F0F0;
}
.location-row:last-child { border-bottom: none; padding-bottom: 0; }
.location-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    margin-top: 1px;
}
.icon-take { background: #EAF3DE; color: #27500A; }
.icon-land { background: #FCEBEB; color: #791F1F; }
.location-info { flex: 1; }
.location-key { font-size: 11px; color: #888; margin-bottom: 3px; }
.location-val { font-size: 13px; color: #1A1A1A; line-height: 1.4; }
.location-val.placeholder { color: #BBB; }

/* ========== 点検チェック ========== */
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check-item {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 10px;
    border: 0.5px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #1A1A1A;
    background: #fff;
    transition: background 0.1s, border-color 0.1s;
    user-select: none;
}
.check-item.checked { background: #E6F1FB; border-color: #85B7EB; color: #0C447C; }
.check-dot {
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 1.5px solid #CCC;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}
.check-item.checked .check-dot { background: #378ADD; border-color: #378ADD; color: #fff; }

/* ========== アラート ========== */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}
.alert-warn { background: #FAEEDA; color: #633806; border: 0.5px solid #FAC775; }
.alert-ok   { background: #EAF3DE; color: #27500A; border: 0.5px solid #C0DD97; }
.alert-error{ background: #FCEBEB; color: #791F1F; border: 0.5px solid #F7C1C1; }

/* ========== ローディングスピナー ========== */
.gps-loading { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #888; }
.spinner {
    width: 12px; height: 12px;
    border: 1.5px solid #E0E0E0;
    border-top-color: #888;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== ログイン画面 ========== */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.login-card {
    background: #fff;
    border: 0.5px solid #E0E0E0;
    border-radius: 16px;
    padding: 2rem 2rem 2.5rem;
    width: 100%;
    max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .title { font-size: 22px; font-weight: 600; color: #1F4E79; }
.login-logo .title span { color: #1D9E75; }
.login-logo .sub { font-size: 12px; color: #AAA; margin-top: 4px; }

/* ========== ダッシュボード（一覧） ========== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin: 1.5rem 0 1rem;
}
.page-title { font-size: 18px; font-weight: 600; color: #1F4E79; }
.btn-new {
    background: #1D9E75; color: #fff;
    border: none; border-radius: 8px;
    padding: 9px 18px; font-size: 14px; font-weight: 500;
    cursor: pointer; display: inline-block;
}
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 0.5px solid #E0E0E0;
}
.log-table th {
    background: #F8F8F8;
    padding: 10px 14px;
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: #666;
    border-bottom: 0.5px solid #E0E0E0;
}
.log-table td {
    padding: 12px 14px;
    border-bottom: 0.5px solid #F0F0F0;
    vertical-align: middle;
}
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: #FAFAFA; }
.duration { font-variant-numeric: tabular-nums; }

/* ========== 保存完了カード ========== */
.saved-card {
    background: #EAF3DE;
    border: 0.5px solid #C0DD97;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 12px;
}
.saved-title { font-size: 14px; font-weight: 500; color: #27500A; margin-bottom: 10px; }
.saved-row {
    display: flex; justify-content: space-between;
    padding: 5px 0;
    border-bottom: 0.5px solid #C0DD97;
    font-size: 12px;
}
.saved-row:last-child { border-bottom: none; }
.saved-key { color: #3B6D11; }
.saved-val { color: #173404; font-weight: 500; text-align: right; max-width: 65%; }

/* ========== レスポンシブ ========== */
@media (max-width: 480px) {
    .log-table th:nth-child(3),
    .log-table td:nth-child(3) { display: none; }
}
