:root {
    --sidebar-width: 240px;
    --bg: #f6f8fc;
    --surface: #ffffff;
    --text: #202124;
    --muted: #5f6368;
    --border: #e8eaed;
    --blue: #1a73e8;
    --blue-soft: #e8f0fe;
    --folder: #fbbc04;
    --green: #137333;
    --green-bg: #e6f4ea;
    --yellow: #b06000;
    --yellow-bg: #fef7e0;
    --red: #c5221f;
    --red-bg: #fce8e6;
    --gray-bg: #f1f3f4;
    --shadow: 0 1px 2px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.08);
    --shadow-hover: 0 1px 3px rgba(60, 64, 67, 0.2), 0 4px 8px rgba(60, 64, 67, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Kabuk ---------- */

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Yönetim paneli koyu kenar çubuğu, kullanıcı portalı açık kalır. */
.sidebar--admin {
    background: #1f2937;
    border-right: 0;
}

.sidebar--admin .brand,
.sidebar--admin .nav-item,
.sidebar--admin .user-info strong {
    color: #e5e7eb;
}

.sidebar--admin .brand small,
.sidebar--admin .user-info small,
.sidebar--admin .sidebar-user a {
    color: #9ca3af;
}

.brand--portal {
    padding-bottom: 12px;
}

.sidebar--admin .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar--admin .nav-item.active {
    background: rgba(147, 197, 253, 0.18);
    color: #bfdbfe;
}

.sidebar--admin .sidebar-user {
    border-top-color: rgba(255, 255, 255, 0.12);
}

.user-avatar--green {
    background: var(--green-bg);
    color: var(--green);
}

/* Kullanıcı portalında sol panel doğrudan klasör ağacıdır. */
.sidebar--portal {
    width: 300px;
    padding: 16px 10px;
}

.company-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: var(--green-bg);
}

.company-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.company-text {
    min-width: 0;
    flex: 1;
}

.company-text strong {
    display: block;
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-text small {
    color: var(--muted);
    font-size: 11px;
}

.icon-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

.tree-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 8px;
}

.dropdown-item i {
    width: 18px;
    color: var(--muted);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    padding: 8px 10px 24px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #e6f4ea;
    color: #137333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 24px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.nav-item:hover {
    background: #f1f3f4;
    color: var(--text);
}

.nav-item.active {
    background: var(--blue-soft);
    color: var(--blue);
}

.sidebar-user {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    min-width: 0;
    flex: 1;
}

.user-info strong {
    display: block;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info small {
    color: var(--muted);
    font-size: 11px;
}

.sidebar-user a {
    color: var(--muted);
    font-size: 18px;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.topbar {
    padding: 16px 28px 0;
    min-height: 16px;
}

.search-form {
    max-width: 720px;
    margin: 0 auto;
    background: #e9eef6;
    border-radius: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
}

.search-form i {
    color: var(--muted);
}

.search-form input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 15px;
}

.content {
    padding: 24px 32px 48px;
}

/* ---------- Genel bileşenler ---------- */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 4px;
}

.breadcrumb-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.breadcrumb-nav a {
    color: var(--blue);
    text-decoration: none;
}

.breadcrumb-nav .current {
    color: var(--text);
    font-weight: 600;
}

.panel {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 18px 20px 0;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.upload-panel {
    max-width: 720px;
    padding: 24px;
}

.table {
    margin: 0;
}

.table thead th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom-color: var(--border);
    padding: 14px 16px;
}

.table td {
    padding: 14px 16px;
    border-bottom-color: var(--border);
}

.stat-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px 20px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 500;
    line-height: 1;
}

.stat-red .stat-value {
    color: var(--red);
}

.stat-yellow .stat-value {
    color: var(--yellow);
}

/* ---------- Drive görünümü ---------- */

.drive-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.tree-panel {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px 10px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.tree-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    padding: 4px 10px 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tree-root {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.tree-root:hover {
    background: #f1f3f4;
    color: var(--text);
}

.tree-root.active {
    background: var(--blue-soft);
    color: var(--blue);
}

.folder-tree {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.folder-tree .folder-tree {
    padding-left: 16px;
    display: none;
}

.tree-item.open > .folder-tree {
    display: block;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 2px;
    border-radius: 8px;
    padding: 2px 4px;
}

.tree-row:hover {
    background: #f1f3f4;
}

.tree-row.active {
    background: var(--blue-soft);
}

.tree-row.active > a {
    color: var(--blue);
    font-weight: 600;
}

.tree-row > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    flex: 1;
    min-width: 0;
}

.tree-row > a i {
    color: var(--folder);
    flex-shrink: 0;
}

.tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-count {
    margin-left: auto;
    background: var(--gray-bg);
    color: var(--muted);
    border-radius: 10px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 600;
}

.tree-toggle {
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 20px;
    height: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.tree-item.open > .tree-row > .tree-toggle {
    transform: rotate(90deg);
}

.tree-spacer {
    width: 20px;
    flex-shrink: 0;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.folder-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px 16px 16px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.folder-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
    color: var(--text);
}

.folder-icon {
    font-size: 42px;
    color: var(--folder);
    margin-bottom: 10px;
    line-height: 1;
}

.folder-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.folder-meta {
    color: var(--muted);
    font-size: 13px;
}

/* ---------- Rozetler ---------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

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

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

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

.status-gray {
    background: var(--gray-bg);
    color: var(--muted);
}

.role-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.role-super_admin {
    background: #e8f0fe;
    color: #1a73e8;
}

.role-admin {
    background: #f3e8fd;
    color: #7627bb;
}

.role-controller {
    background: var(--gray-bg);
    color: var(--muted);
}

.perm-chip {
    display: inline-block;
    background: var(--gray-bg);
    color: var(--muted);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    margin: 2px 2px 0 0;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
}

.empty-state h1 {
    font-size: 22px;
    color: var(--text);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-list li:last-child {
    border-bottom: 0;
}

.activity-detail {
    font-size: 14px;
}

.activity-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.structure-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.selection-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-soft);
    color: #174ea6;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}

.company-picker {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.template-tree,
.template-tree ul {
    list-style: none;
    padding-left: 18px;
}

.template-tree {
    padding-left: 0;
    margin: 0;
}

.template-tree li {
    padding: 3px 0;
}

.template-tree i {
    color: var(--folder);
    margin-right: 6px;
}

/* ---------- Giriş ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-hover);
    padding: 32px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.login-brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.login-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    object-fit: cover;
    display: block;
}

.login-logo--small {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.login-brand--home {
    flex-direction: column;
    align-items: flex-start;
}

.login-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-choice .btn {
    padding: 12px 16px;
}

.login-note {
    color: var(--muted);
    font-size: 13px;
    margin: 16px 0 20px;
}

.btn-outline-primary {
    border-radius: 24px;
}

.ticket-company {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
}

.ticket-company-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

.ticket-company-head::-webkit-details-marker {
    display: none;
}

.ticket-company-head i {
    color: var(--folder);
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Bootstrap ince ayar ---------- */

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    border-radius: 24px;
    padding: 8px 16px;
}

.btn-outline-secondary,
.btn-outline-danger {
    border-radius: 20px;
}

.dropdown-item button,
.dropdown-menu form {
    width: 100%;
}

.modal-content {
    border: 0;
    border-radius: 16px;
}

.form-control,
.form-select,
.form-control:focus {
    border-radius: 10px;
}

@media (max-width: 1100px) {
    .drive-layout {
        grid-template-columns: 1fr;
    }

    .tree-panel {
        position: relative;
        max-height: 320px;
    }
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar,
    .sidebar--portal {
        width: 100%;
        height: auto;
        position: relative;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .tree-scroll {
        max-height: 320px;
    }

    .content {
        padding: 20px;
    }
}
