/* ========================================
   少額訴訟 訴状作成システム - スタイルシート
   ======================================== */

:root {
    /* カラーパレット */
    --color-primary: #1e3a5f;
    --color-primary-light: #2d5a8a;
    --color-primary-dark: #0f1f33;
    --color-accent: #c9a227;
    --color-accent-light: #e5c85a;

    --color-bg: #f5f7fa;
    --color-bg-dark: #e8edf3;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;

    --color-text: #1a1a2e;
    --color-text-secondary: #4a5568;
    --color-text-muted: #718096;

    --color-border: #e2e8f0;
    --color-border-light: #edf2f7;

    --color-success: #38a169;
    --color-warning: #d69e2e;
    --color-error: #e53e3e;

    /* シャドウ */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

    /* トランジション */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* フォント */
    --font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;

    /* サイズ */
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* ダークモード */
[data-theme="dark"] {
    --color-primary: #2d5a8a;
    --color-primary-light: #4a7ab8;
    --color-primary-dark: #1e3a5f;
    --color-accent: #e5c85a;
    --color-accent-light: #f0d878;

    --color-bg: #1a1a2e;
    --color-bg-dark: #0f0f1a;
    --color-surface: #252540;
    --color-surface-elevated: #2a2a4a;

    --color-text: #e8e8f0;
    --color-text-secondary: #a0a0b8;
    --color-text-muted: #707088;

    --color-border: #3a3a5a;
    --color-border-light: #2a2a4a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* ========================================
   リセット & ベース
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   レイアウト
   ======================================== */

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

/* サイドバー */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 機能ツールバー */
.sidebar-toolbar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 12px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.toolbar-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.toolbar-label {
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

/* 拡張機能メニュー */
.extended-features-menu {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
    padding-left: 4px;
}

.feature-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.feature-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
}

.feature-menu-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

.feature-menu-btn:active {
    transform: scale(0.95);
}

.feature-icon {
    font-size: 1.2rem;
}

.feature-label {
    font-size: 0.55rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ========================================
   新サイドバーナビゲーション (LawOffice Pro)
   ======================================== */

/* ロゴエリア */
.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 10px;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.02em;
}

.logo-subtitle {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
}

/* クイックツールバー（コンパクト版） */
.sidebar-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar-btn {
    padding: 6px;
    font-size: 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* 新ナビゲーション */
.sidebar-nav-new {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.nav-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-section-icon {
    font-size: 1rem;
}

.nav-section-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.nav-section-arrow {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s;
}

.nav-section-content {
    display: none;
    padding: 0 8px 8px 8px;
}

.nav-section-content.expanded {
    display: block;
}

/* 案件セレクター（コンパクト版） */
.case-selector-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
}

.case-selector-compact select {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    outline: none;
}

.case-selector-compact select option {
    background: #1a1a2e;
    color: white;
}

.case-action-btns {
    display: flex;
    gap: 4px;
}

.btn-mini {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mini:hover {
    background: rgba(59, 130, 246, 0.5);
}

.btn-mini.danger:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* 書類種類セレクター */
.doc-type-select {
    width: 100%;
    padding: 8px 10px;
    margin: 0 6px 8px 6px;
    width: calc(100% - 12px);
    font-size: 0.8rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: white;
    outline: none;
}

.doc-type-select:focus {
    border-color: rgba(59, 130, 246, 0.6);
}

.doc-type-select option {
    background: #1a1a2e;
    color: white;
}

/* サブアイテム */
.nav-sub-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 6px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.nav-sub-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-sub-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* サブアイテム（アイコン） */
.sub-icon {
    font-size: 0.9rem;
}

.btn-lang {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-lang:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.logo svg {
    width: 32px;
    height: 32px;
    color: var(--color-accent);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 書類種類セレクタ */
.document-type-selector {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.document-type-selector label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.document-type-selector select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.document-type-selector select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.document-type-selector select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-accent);
}

.document-type-selector select option {
    background: var(--color-primary-dark);
    color: white;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px;
    transition: all var(--transition-fast);
    text-align: left;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.nav-item.active svg {
    color: var(--color-accent);
}

/* ドキュメントフォーム切替 */
.document-form {
    display: none !important;
}

.document-form.active {
    display: flex !important;
    flex-direction: column;
}

/* ラジオボタン */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.radio-item:hover {
    background: var(--color-bg-dark);
}

.radio-item input[type="radio"] {
    display: none;
}

.radio-item .radiomark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.radio-item input:checked+.radiomark {
    border-color: var(--color-primary);
}

.radio-item input:checked+.radiomark::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
}

/* 印刷ボタン */
.btn-print {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-print svg {
    width: 18px;
    height: 18px;
}

.btn-print:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* PDFボタン */
.btn-pdf {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--color-accent);
    color: var(--color-primary-dark);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3);
}

.btn-pdf svg {
    width: 20px;
    height: 20px;
}

.btn-pdf:hover {
    background: var(--color-accent-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(201, 162, 39, 0.4);
}

.btn-pdf:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

/* データ管理セクション */
.sidebar-data-management {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.data-management-title {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-management-buttons {
    display: flex;
    gap: 8px;
}

.btn-data {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-data svg {
    width: 18px;
    height: 18px;
}

.btn-data:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

/* スピンアニメーション */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    padding-top: 72px;
    /* ヘッダーバー分 */
    max-width: calc(100vw - var(--sidebar-width));
}

/* トップヘッダーバー */
.top-header-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

.header-bar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-user-name {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.header-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-bar-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.header-bar-btn.logout-btn {
    color: var(--color-error);
}

.header-bar-btn.logout-btn:hover {
    background: rgba(229, 62, 62, 0.1);
}

[data-theme="dark"] .top-header-bar {
    background: var(--color-surface);
    border-bottom-color: var(--color-border);
}

.section {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content Header */
.section-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-header-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-header-action:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-header-action.primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-header-action.primary:hover {
    background-color: var(--primary-hover);
}

.btn-header-action svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   フォーム
   ======================================== */

.form-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
}

.form-card {
    background: var(--color-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow var(--transition-normal);
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
}

.form-card.highlight {
    border: 2px solid var(--color-accent);
}

.form-card.highlight .form-card-header {
    background: linear-gradient(135deg, var(--color-accent) 0%, #b8921f 100%);
    color: white;
}

.form-card-header {
    padding: 16px 24px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
}

.form-card.highlight .form-card-header h2 {
    color: white;
}

.badge {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-card-body {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group.large input {
    font-size: 1.5rem;
    padding: 16px 20px;
    font-weight: 600;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input:read-only {
    background: var(--color-bg);
    color: var(--color-text-secondary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 0;
}

.input-with-unit input {
    flex: 1;
    border-radius: 10px 0 0 10px;
    border-right: none;
}

.input-with-unit .unit {
    padding: 12px 16px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.helper-text {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* チェックボックス */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.checkbox-item:hover {
    background: var(--color-bg-dark);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-item .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox-item input:checked+.checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-item input:checked+.checkmark::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

/* フォームアクション */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
}

/* ========================================
   ボタン
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.btn-primary:hover {
    background: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 58, 95, 0.4);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text-secondary);
}

.btn-secondary:hover {
    background: var(--color-bg-dark);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

/* ========================================
   プレビュー
   ======================================== */

.preview-container {
    max-width: 900px;
}

.preview-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.document-preview {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    padding: 60px 80px;
    min-height: 800px;
}

/* 訴状スタイル */
.lawsuit-document {
    font-family: 'Noto Sans JP', serif;
    color: #000;
    line-height: 1.8;
}

.doc-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 48px;
    letter-spacing: 0.5em;
    padding-left: 0.5em;
}

.doc-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.doc-meta-left {
    text-align: left;
}

.doc-meta-right {
    text-align: right;
}

.doc-section {
    margin-bottom: 28px;
}

.doc-section-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #000;
}

.doc-section-content {
    padding-left: 16px;
}

.doc-row {
    display: flex;
    margin-bottom: 8px;
}

.doc-label {
    min-width: 120px;
    font-weight: 500;
}

.doc-value {
    flex: 1;
}

.doc-amount {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border: 2px solid #000;
    margin: 16px 0;
}

.doc-signature {
    margin-top: 48px;
    text-align: right;
}

.doc-signature-line {
    margin-bottom: 8px;
}

.doc-court {
    margin-top: 48px;
    font-weight: 600;
}

.doc-attachments {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px dashed #999;
}

.doc-attachments ul {
    list-style: none;
    padding-left: 0;
}

.doc-attachments li {
    padding: 4px 0;
}

.doc-attachments li::before {
    content: '□ ';
}

/* ========================================
   印刷スタイル
   ======================================== */

@media print {
    body {
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .app-container,
    .sidebar,
    .main-content,
    .section-header,
    .preview-actions {
        display: none !important;
    }

    .print-only {
        display: block !important;
        padding: 0;
        margin: 0;
    }

    .lawsuit-document {
        font-size: 11pt;
        line-height: 1.8;
    }

    .doc-title {
        font-size: 16pt;
        margin-bottom: 30pt;
    }

    @page {
        size: A4;
        margin: 20mm;
    }
}

.print-only {
    display: none;
}

/* ========================================
   レスポンシブ
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
        padding: 24px;
        padding-top: 72px;
    }

    .top-header-bar {
        left: 220px;
    }

    .document-preview {
        padding: 40px 50px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-nav {
        flex-direction: row;
        padding: 12px;
    }

    .nav-item {
        flex: 1;
        justify-content: center;
        padding: 10px;
    }

    .nav-item span {
        display: none;
    }

    /* sidebar-footer removed from HTML */

    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 60px;
    }

    .top-header-bar {
        left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    .document-preview {
        padding: 30px;
    }

    .preview-actions {
        flex-direction: column;
        gap: 12px;
    }

    .preview-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   案件管理セクション
   ======================================== */

.case-management-section {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.case-management-section label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.case-management-section select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-family: inherit;
    margin-bottom: 10px;
}

.case-buttons {
    display: flex;
    gap: 8px;
}

.btn-case {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-case svg {
    width: 16px;
    height: 16px;
}

.btn-case:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.btn-checklist {
    background: rgba(46, 125, 50, 0.2);
    border-color: rgba(46, 125, 50, 0.4);
}

.btn-checklist:hover {
    background: rgba(46, 125, 50, 0.3);
}

/* ========================================
   テンプレートボタン
   ======================================== */

.template-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 4px;
    background: var(--color-primary-light);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: all var(--transition-fast);
}

.template-btn:hover {
    opacity: 1;
    transform: scale(1.05);
}

.template-btn svg {
    width: 100%;
    height: 100%;
}

/* ========================================
   モーダルダイアログ
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* モーダル本体（すべてのモーダルに適用） */
.modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--color-primary);
    color: white;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--color-bg);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* テンプレート関連 */
.template-actions {
    margin-bottom: 20px;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-item {
    padding: 16px;
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid var(--color-bg-dark);
}

.template-name {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.template-preview {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.template-item-actions {
    display: flex;
    gap: 8px;
}

.btn-template-use,
.btn-template-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-template-use {
    background: var(--color-primary);
    color: white;
}

.btn-template-use:hover {
    background: var(--color-primary-light);
}

.btn-template-delete {
    background: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
}

.btn-template-delete:hover {
    background: rgba(211, 47, 47, 0.2);
}

.no-templates {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 30px;
}

/* チェックリスト */
.modal-checklist {
    max-width: 550px;
}

.validation-errors {
    background: rgba(211, 47, 47, 0.1);
    border: 1px solid rgba(211, 47, 47, 0.3);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.validation-errors h4 {
    margin: 0 0 10px 0;
    color: #d32f2f;
    font-size: 0.95rem;
}

.validation-errors ul {
    margin: 0;
    padding-left: 20px;
    color: #b71c1c;
    font-size: 0.9rem;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checklist-item:hover {
    background: var(--color-bg-dark);
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

.checklist-item .checkmark {
    display: none;
}

/* ボタンスタイル */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-light);
}

.btn-secondary {
    background: var(--color-bg-dark);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: #d8dde3;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* ========================================
   機能拡張スタイル
   ======================================== */

/* ダークモード切替ボタン */
.btn-theme {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-theme:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 統計ダッシュボード */
.stats-modal {
    max-width: 450px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.stat-breakdown {
    background: var(--color-bg);
    border-radius: 10px;
    padding: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.stat-item:last-child {
    border-bottom: none;
}

.stats-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.no-data {
    text-align: center;
    color: var(--color-text-muted);
    padding: 20px;
}

/* バージョン表示トースト */
.version-toast {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    border-left: 4px solid var(--color-accent);
}

.version-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ヘッダーボタングループ */
.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    max-width: 140px;
}

/* ショートカットヘルプ */
.shortcuts-help {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 16px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
}

.shortcuts-help kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8em;
}

/* ========================================
   カレンダービュー
   ======================================== */

#calendar-section {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    min-width: 180px;
    text-align: center;
}

.calendar-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.calendar-today-btn {
    padding: 8px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-today-btn:hover {
    background: var(--color-primary-light);
    transform: translateY(-1px);
}

.calendar-grid {
    background: var(--color-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--color-primary);
}

.calendar-weekday {
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.calendar-weekday.sunday {
    color: #ff8a8a;
}

.calendar-weekday.saturday {
    color: #8ac4ff;
}

.calendar-days {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 1px;
    background: var(--color-border);
    width: 100%;
}

.calendar-day {
    min-height: 80px;
    max-height: 120px;
    padding: 8px;
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.calendar-day:hover {
    background: var(--color-bg);
}

.calendar-day.other-month {
    background: var(--color-bg-dark);
    cursor: default;
}

.calendar-day.other-month .day-number {
    color: var(--color-text-muted);
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
}

.calendar-day.today .day-number {
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day.selected {
    background: rgba(59, 130, 246, 0.15);
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.calendar-day.sunday .day-number {
    color: #e53e3e;
}

.calendar-day.saturday .day-number {
    color: #3182ce;
}

.day-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.event-dots {
    display: flex;
    gap: 4px;
    margin-top: auto;
    flex-wrap: wrap;
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.event-dot.deadline {
    background: #e53e3e;
}

.event-dot.reminder {
    background: #d69e2e;
}

.event-dot.appointment {
    background: #38a169;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: var(--color-surface);
    border-radius: 0 0 16px 16px;
    margin-top: -8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* イベントリスト */
.calendar-event-list {
    margin-top: 24px;
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.event-list-header {
    padding: 16px 20px;
    background: var(--color-primary);
    color: white;
}

#selected-date-display {
    font-size: 1rem;
    font-weight: 600;
}

.event-list-content {
    padding: 16px;
    min-height: 120px;
}

.no-events {
    text-align: center;
    color: var(--color-text-muted);
    padding: 32px;
    font-size: 0.95rem;
}

.event-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    border-left: 4px solid var(--color-primary);
    transition: all var(--transition-fast);
}

.event-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.event-item.high {
    border-left-color: #e53e3e;
}

.event-item.medium {
    border-left-color: #d69e2e;
}

.event-item.low {
    border-left-color: #38a169;
}

.event-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.event-type-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.event-type-badge.deadline {
    background: rgba(229, 62, 62, 0.15);
    color: #e53e3e;
}

.event-type-badge.reminder {
    background: rgba(214, 158, 46, 0.15);
    color: #d69e2e;
}

.event-type-badge.appointment {
    background: rgba(56, 161, 105, 0.15);
    color: #38a169;
}

.event-title {
    flex: 1;
    font-size: 0.95rem;
    color: var(--color-text);
}

.completed-badge {
    font-size: 0.8rem;
    color: var(--color-success);
    font-weight: 500;
}

.add-event-btn {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: 10px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-event-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    border-style: solid;
}

/* ミニカレンダー */
.mini-calendar {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.mini-calendar-header {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
}

.mini-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.mini-calendar-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.mini-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-calendar-days span {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 50%;
    color: var(--color-text);
}

.mini-calendar-days span.empty {
    visibility: hidden;
}

.mini-calendar-days span.today {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

.mini-calendar-days span.has-events {
    background: rgba(214, 158, 46, 0.2);
    color: var(--color-warning);
    font-weight: 600;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .calendar-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .calendar-title {
        font-size: 1.2rem;
        min-width: auto;
        order: -1;
        flex-basis: 100%;
    }

    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }

    .day-number {
        font-size: 0.8rem;
    }

    .event-dots {
        gap: 2px;
    }

    .event-dot {
        width: 6px;
        height: 6px;
    }

    .calendar-legend {
        gap: 12px;
        flex-wrap: wrap;
    }

    .legend-item {
        font-size: 0.75rem;
    }
}

/* ========================================
   UX強化スタイル
   ======================================== */

/* グローバル検索 */
#global-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    padding-top: 10vh;
}

.global-search-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.global-search-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: var(--color-surface, white);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: searchSlideIn 0.2s ease;
}

@keyframes searchSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.global-search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border, #eee);
    gap: 12px;
}

.global-search-header .search-icon {
    font-size: 1.2rem;
}

.global-search-header input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
    color: var(--color-text, #333);
}

.global-search-header kbd {
    padding: 4px 8px;
    background: var(--color-bg, #f0f4f8);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted, #666);
}

.global-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.search-section {
    padding: 0 16px;
    margin-bottom: 16px;
}

.search-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted, #888);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 0 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--color-bg, #f0f4f8);
}

.search-result-item .result-icon {
    font-size: 1.2rem;
}

.search-result-item .result-text {
    flex: 1;
    color: var(--color-text, #333);
}

.search-result-item .result-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted, #888);
}

.search-result-item .result-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--color-primary, #1e3a5f);
    color: white;
    border-radius: 10px;
}

.search-hint {
    padding: 8px 12px;
    color: var(--color-text-muted, #888);
    font-size: 0.9rem;
}

.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted, #888);
}

.search-no-results p {
    margin-top: 10px;
}

.search-loading {
    text-align: center;
    padding: 30px;
    color: var(--color-text-muted, #888);
}

/* クイックメモパネル */
#quick-memo-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: var(--color-surface, white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

.quick-memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-primary, #1e3a5f);
    color: white;
    font-weight: 600;
}

#quick-memo-textarea {
    width: 100%;
    height: 150px;
    padding: 12px;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--color-surface, white);
    color: var(--color-text, #333);
}

.quick-memo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--color-border, #eee);
    background: var(--color-bg, #f9fafb);
}

/* ポモドーロタイマー */
#pomodoro-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 200px;
    background: var(--color-surface, white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    overflow: hidden;
}

.pomodoro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #ef4444;
    color: white;
    font-weight: 600;
}

.pomodoro-display {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    color: var(--color-text, #333);
    font-family: 'Courier New', monospace;
}

.pomodoro-status {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted, #888);
    padding-bottom: 12px;
}

.pomodoro-controls {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
}

.pomodoro-controls button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    background: var(--color-bg, #f0f4f8);
    color: var(--color-text, #333);
    transition: background 0.15s;
}

.pomodoro-controls button:hover {
    background: var(--color-border, #e0e0e0);
}

/* 自動保存インジケータ */
#autosave-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--color-surface, white);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    color: var(--color-text, #333);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 8000;
}

#autosave-indicator.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#autosave-indicator[data-status="saving"] {
    background: #fef3c7;
}

#autosave-indicator[data-status="saved"] {
    background: #d1fae5;
}

#autosave-indicator[data-status="error"] {
    background: #fee2e2;
}

/* セッション警告 */
#session-warning {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ダークモード追加スタイル */
[data-theme="dark"] .global-search-container,
[data-theme="dark"] #quick-memo-panel,
[data-theme="dark"] #pomodoro-panel,
[data-theme="dark"] #autosave-indicator {
    background: var(--color-surface);
}

[data-theme="dark"] .global-search-header input,
[data-theme="dark"] #quick-memo-textarea {
    background: var(--color-surface);
    color: var(--color-text);
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .pomodoro-controls button {
    background: var(--color-bg);
}

/* ダークモード - サイドバー */
[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

[data-theme="dark"] .nav-sub-item:hover {
    background: var(--color-bg);
}

[data-theme="dark"] .modal {
    background: var(--color-surface) !important;
    color: var(--color-text);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .main-content {
    background: var(--color-bg);
}

[data-theme="dark"] .form-card,
[data-theme="dark"] .preview-content {
    background: var(--color-surface);
    color: var(--color-text);
}

[data-theme="dark"] .section-content {
    background: var(--color-surface);
}

/* アニメーション */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}