:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --sidebar-bg: #1f2937;
    --sidebar-text: #d1d5db;
    --white: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --status-new: #ef4444;
    --status-pending: #f59e0b;
    --status-resolved: #10b981;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 30px;
}

.nav-menu {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.2s;
}

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

.nav-item i {
    width: 24px;
    margin-right: 10px;
}

.user-profile {
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
}

.info {
    display: flex;
    flex-direction: column;
}

.info .name {
    color: var(--white);
    font-weight: 500;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s;
}

.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Top Bar */
.top-bar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    font-size: 0.9rem;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

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

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

.btn-icon {
    background: transparent;
    padding: 10px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: var(--border-color);
}

/* Email List */
.email-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.email-list-header {
    display: grid;
    grid-template-columns: 80px 200px 1fr 150px 150px;
    padding: 10px 20px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.email-list {
    background: var(--white);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.email-item {
    display: grid;
    grid-template-columns: 80px 200px 1fr 150px 150px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.1s;
    align-items: center;
}

.email-item:hover {
    background-color: #f9fafb;
}

.email-item.unread {
    background-color: #eff6ff;
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: white;
}

.status-new {
    background-color: var(--status-new);
}

.status-pending {
    background-color: var(--status-pending);
}

.status-resolved {
    background-color: var(--status-resolved);
}

/* Detail View */
.detail-header {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.meta-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-left: 10px;
}

.email-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: var(--white);
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.email-header-info {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.email-header-info h2 {
    margin-bottom: 10px;
}

.sender-info,
.recipient-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.sender-info .label,
.recipient-info .label {
    font-weight: 600;
    color: var(--text-main);
}

.email-body {
    line-height: 1.6;
    margin-bottom: 30px;
}

.reply-area {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.reply-area textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    margin-bottom: 10px;
    font-family: inherit;
}

/* Compose Form */
.compose-form {
    padding: 30px;
    background: var(--white);
    margin: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.compose-form input,
.compose-form textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.compose-form textarea {
    height: 300px;
    resize: vertical;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #111827 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 40px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 24px;
}

.login-logo i {
    font-size: 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 24px;
    text-align: center;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-field label {
    display: block;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-top: 8px;
}

.nav-item-logout {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.7);
}

.nav-item-logout:hover {
    background-color: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}
